{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import torch"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'1.0.0'"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "torch.__version__"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# CUDA_VISIBLE_DEVICES=2\n",
    "# torch.cuda.set_device(1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "os.environ['CUDA_VISIBLE_DEVICES'] = '0,1'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "'''MobileNetV3 in PyTorch.\n",
    "See the paper \"Inverted Residuals and Linear Bottlenecks:\n",
    "Mobile Networks for Classification, Detection and Segmentation\" for more details.\n",
    "'''\n",
    "import torch\n",
    "import torch.nn as nn\n",
    "import torch.nn.functional as F\n",
    "from torch.nn import init"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "def Hswish(x,inplace=True):\n",
    "    return x * F.relu6(x + 3., inplace=inplace) / 6.\n",
    "\n",
    "def Hsigmoid(x,inplace=True):\n",
    "    return F.relu6(x + 3., inplace=inplace) / 6.\n",
    "\n",
    "\n",
    "# Squeeze-And-ExciteÄ£¿é\n",
    "class SEModule(nn.Module):\n",
    "    def __init__(self, channel, reduction=4):\n",
    "        super(SEModule, self).__init__()\n",
    "        self.avg_pool = nn.AdaptiveAvgPool2d(1)\n",
    "        self.se = nn.Sequential(\n",
    "            nn.Linear(channel, channel // reduction, bias=False),\n",
    "            nn.ReLU(inplace=True),\n",
    "            nn.Linear(channel // reduction, channel, bias=False),\n",
    "        )\n",
    "\n",
    "    def forward(self, x):\n",
    "        b, c, _, _ = x.size()\n",
    "        y=self.avg_pool(x).view(b, c)\n",
    "        y=self.se(y)\n",
    "        y = Hsigmoid(y).view(b, c, 1, 1)\n",
    "        return x * y.expand_as(x)\n",
    "\n",
    "class Bottleneck(nn.Module):\n",
    "    def __init__(self,in_channels,out_channels,kernel_size,exp_channels,stride,se='True',nl='HS'):\n",
    "        super(Bottleneck, self).__init__()\n",
    "        padding = (kernel_size - 1) // 2\n",
    "        if nl == 'RE':\n",
    "            self.nlin_layer = F.relu6\n",
    "        elif nl == 'HS':\n",
    "            self.nlin_layer = Hswish\n",
    "        self.stride=stride\n",
    "        if se:\n",
    "            self.se=SEModule(exp_channels)\n",
    "        else:\n",
    "            self.se=None\n",
    "        self.conv1=nn.Conv2d(in_channels,exp_channels,kernel_size=1,stride=1,padding=0,bias=False)\n",
    "        self.bn1 = nn.BatchNorm2d(exp_channels)\n",
    "        self.conv2=nn.Conv2d(exp_channels,exp_channels,kernel_size=kernel_size,stride=stride,\n",
    "                             padding=padding,groups=exp_channels,bias=False)\n",
    "        self.bn2=nn.BatchNorm2d(exp_channels)\n",
    "        self.conv3=nn.Conv2d(exp_channels,out_channels,kernel_size=1,stride=1,padding=0,bias=False)\n",
    "        self.bn3=nn.BatchNorm2d(out_channels)\n",
    "        # ÏÈ³õÊ¼»¯Ò»¸ö¿ÕÐòÁÐ£¬Ö®ºó¸ÄÔìÆä³ÉÎª²Ð²îÁ´½Ó\n",
    "        self.shortcut = nn.Sequential()\n",
    "        # Ö»ÓÐ²½³¤Îª1ÇÒÊäÈëÊä³öÍ¨µÀ²»ÏàÍ¬Ê±²Å²ÉÓÃÌøÔ¾Á¬½Ó(ÏëÒ»ÏÂÌøÔ¾Á´½ÓµÄ¹ý³Ì£¬ÊäÈëÊä³öÍ¨µÀÏàÍ¬Õâ¸öÌøÔ¾Á¬½Ó¾ÍÃ»ÒâÒåÁË)\n",
    "        if stride == 1 and in_channels != out_channels:\n",
    "            self.shortcut = nn.Sequential(\n",
    "                # ÏÂÃæµÄ²Ù×÷¾í»ý²»¸Ä±ä³ß´çºÍÍ¨µÀÊý\n",
    "                nn.Conv2d(in_channels, out_channels, kernel_size=1, stride=1, padding=0, bias=False),\n",
    "                nn.BatchNorm2d(out_channels)\n",
    "            )\n",
    "\n",
    "    def forward(self,x):\n",
    "        out=self.nlin_layer(self.bn1(self.conv1(x)))\n",
    "        if self.se is not None:\n",
    "            out=self.bn2(self.conv2(out))\n",
    "            out=self.nlin_layer(self.se(out))\n",
    "        else:\n",
    "            out = self.nlin_layer(self.bn2(self.conv2(out)))\n",
    "        out = self.bn3(self.conv3(out))\n",
    "        out = out + self.shortcut(x) if self.stride == 1 else out\n",
    "        return out\n",
    "\n",
    "\n",
    "class MobileNetV3_large(nn.Module):\n",
    "    # (out_channels,kernel_size,exp_channels,stride,se,nl)\n",
    "    cfg=[\n",
    "        (16,3,16,1,False,'RE'),\n",
    "        (24,3,64,2,False,'RE'),\n",
    "        (24,3,72,1,False,'RE'),\n",
    "        (40,5,72,2,True,'RE'),\n",
    "        (40,5,120,1,True,'RE'),\n",
    "        (40,5,120,1,True,'RE'),\n",
    "        (80,3,240,2,False,'HS'),\n",
    "        (80,3,200,1,False,'HS'),\n",
    "        (80,3,184,1,False,'HS'),\n",
    "        (80,3,184,1,False,'HS'),\n",
    "        (112,3,480,1,True,'HS'),\n",
    "        (112,3,672,1,True,'HS'),\n",
    "        (160,5,672,2,True,'HS'),\n",
    "        (160,5,960,1,True,'HS'),\n",
    "        (160,5,960,1,True,'HS')\n",
    "    ]\n",
    "    def __init__(self,num_classes=5):\n",
    "        super(MobileNetV3_large,self).__init__()\n",
    "        self.conv1=nn.Conv2d(3,16,3,2,padding=1,bias=False)\n",
    "        self.bn1=nn.BatchNorm2d(16)\n",
    "        # ¸ù¾ÝcfgÊý×é×Ô¶¯Éú³ÉËùÓÐµÄBottleneck²ã\n",
    "        self.layers = self._make_layers(in_channels=16)\n",
    "        self.conv2=nn.Conv2d(160,960,1,stride=1,bias=False)\n",
    "        self.bn2=nn.BatchNorm2d(960)\n",
    "        # ¾í»ýºó²»¸úBN£¬¾ÍÓ¦¸Ã°ÑbiasÉèÖÃÎªTrue\n",
    "        self.conv3=nn.Conv2d(960,1280,1,1,padding=0,bias=True)\n",
    "        self.conv4=nn.Conv2d(1280,num_classes,1,stride=1,padding=0,bias=True)\n",
    "\n",
    "    def _make_layers(self,in_channels):\n",
    "        layers=[]\n",
    "        for out_channels,kernel_size,exp_channels,stride,se,nl in self.cfg:\n",
    "            layers.append(\n",
    "                Bottleneck(in_channels,out_channels,kernel_size,exp_channels,stride,se,nl)\n",
    "            )\n",
    "            in_channels=out_channels\n",
    "        return nn.Sequential(*layers)\n",
    "\n",
    "    def forward(self,x):\n",
    "        out=Hswish(self.bn1(self.conv1(x)))\n",
    "        out=self.layers(out)\n",
    "        out=Hswish(self.bn2(self.conv2(out)))\n",
    "        out=F.avg_pool2d(out,7)\n",
    "        out=Hswish(self.conv3(out))\n",
    "        out=self.conv4(out)\n",
    "        # ÒòÎªÔ­ÂÛÎÄÖÐ×îºóÒ»²ãÊÇ¾í»ý²ãÀ´ÊµÏÖÈ«Á¬½ÓµÄÐ§¹û£¬Î¬¶ÈÊÇËÄÎ¬µÄ£¬ºóÁ½Î¬ÊÇ1£¬ÔÚ¼ÆËãËðÊ§º¯ÊýµÄÊ±ºòÒªÇó¶þÎ¬£¬Òò´ËÔÚÕâÀïÐèÒª×öÒ»¸öresize\n",
    "        a,b=out.size(0),out.size(1)\n",
    "        out=out.view(a,b)\n",
    "        return out"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "model=MobileNetV3_large()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "# x=torch.randn(2,3,224,224)\n",
    "# y=model(x)\n",
    "# print(y.size())\n",
    "# print(y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "import torchvision\n",
    "from torch.autograd import Variable\n",
    "import torchvision.transforms as transforms\n",
    "import torch.optim as optim\n",
    "from torch.utils.data import DataLoader"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "import random\n",
    "from PIL import Image\n",
    "from torch.utils.data import Dataset\n",
    "\n",
    "random.seed(1)\n",
    "\n",
    "class flowerDataset(Dataset):\n",
    "    # 自定义Dataset类，必须继承Dataset并重写__init__和__getitem__函数\n",
    "    def __init__(self, data_dir, transform=None):\n",
    "        \"\"\"\n",
    "            花朵分类任务的Dataset\n",
    "            :param data_dir: str, 数据集所在路径\n",
    "            :param transform: torch.transform，数据预处理，默认不进行预处理\n",
    "        \"\"\"\n",
    "        # data_info存储所有图片路径和标签（元组的列表），在DataLoader中通过index读取样本\n",
    "        self.data_info = self.get_img_info(data_dir)\n",
    "        self.transform = transform\n",
    "\n",
    "    def __getitem__(self, index):\n",
    "        path_img, label = self.data_info[index]\n",
    "        # 打开图片，默认为PIL，需要转成RGB\n",
    "        img = Image.open(path_img).convert('RGB')\n",
    "        # 如果预处理的条件不为空，应该进行预处理操作\n",
    "        if self.transform is not None:\n",
    "            img = self.transform(img)\n",
    "        return img, label\n",
    "\n",
    "    def __len__(self):\n",
    "        return len(self.data_info)\n",
    "\n",
    "    # 自定义方法，用于返回所有图片的路径以及标签\n",
    "    @staticmethod\n",
    "    def get_img_info(data_dir):\n",
    "        data_info = list()\n",
    "        for root, dirs, _ in os.walk(data_dir):\n",
    "            # 遍历类别\n",
    "            for sub_dir in dirs:\n",
    "                # listdir为列出文件夹下所有文件和文件夹名\n",
    "                img_names = os.listdir(os.path.join(root, sub_dir))\n",
    "                # 过滤出所有后缀名为jpg的文件名（那当然也就把文件夹过滤掉了）\n",
    "#                 img_names = list(filter(lambda x: x.endswith('.jpeg'), img_names))\n",
    "\n",
    "                # 遍历图片\n",
    "                for i in range(len(img_names)):\n",
    "                    img_name = img_names[i]\n",
    "                    path_img = os.path.join(root, sub_dir, img_name)\n",
    "                    # 在该任务中，文件夹名等于标签名\n",
    "                    label = sub_dir\n",
    "                    data_info.append((path_img, int(label)))\n",
    "        return data_info"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "#宏定义一些数据，如epoch数，batchsize等\n",
    "MAX_EPOCH=45\n",
    "BATCH_SIZE=128\n",
    "LR=0.0001\n",
    "log_interval=30\n",
    "val_interval=1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "# ============================ step 1/5 数据 ============================\n",
    "# split_dir=os.path.join(\"MobileNetV3-master\",\".\",\"data\",\"splitData\")\n",
    "split_dir=r'/home/fanrz/Desktop/torchmob/'\n",
    "train_dir=r'/home/fanrz/Desktop/testlarge/aptos/tra2/'\n",
    "valid_dir=os.path.join(split_dir,\"val\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "#对训练集所需要做的预处理\n",
    "train_transform=transforms.Compose([\n",
    "    transforms.Resize((224,224)),\n",
    "    transforms.ToTensor(),\n",
    "])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "#对验证集所需要做的预处理\n",
    "valid_transform=transforms.Compose([\n",
    "    transforms.Resize((224,224)),\n",
    "    transforms.ToTensor(),\n",
    "])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 构建MyDataset实例\n",
    "train_data=flowerDataset(data_dir=train_dir,transform=train_transform)\n",
    "valid_data=flowerDataset(data_dir=valid_dir,transform=valid_transform)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5035\n"
     ]
    }
   ],
   "source": [
    "print(len(train_data.data_info))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 构建DataLoader\n",
    "# 训练集数据最好打乱\n",
    "# DataLoader的实质就是把数据集加上一个索引号，再返回\n",
    "train_loader=DataLoader(dataset=train_data,\n",
    "                        batch_size=BATCH_SIZE,\n",
    "                        shuffle=True,\n",
    "                        drop_last=True)\n",
    "valid_loader=DataLoader(dataset=valid_data,batch_size=BATCH_SIZE,drop_last=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "# ============================ step 2/5 模型 ============================\n",
    "if torch.cuda.is_available():\n",
    "    model=nn.DataParallel(model)\n",
    "    model.cuda()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "# ============================ step 3/5 损失函数 ============================\n",
    "criterion=nn.CrossEntropyLoss()\n",
    "# ============================ step 4/5 优化器 ============================\n",
    "optimizer=optim.Adam(model.parameters(),lr=LR, betas=(0.9, 0.99))# 选择优化器"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "epoch:1,loss:1.3339\n",
      "============================================\n",
      "源数据标签： tensor([3, 3, 2, 0, 1, 1, 4, 2, 0, 2, 0, 4, 0, 0, 3, 4, 2, 2, 0, 2, 3, 0, 2, 1,\n",
      "        2, 2, 1, 3, 0, 1, 1, 4, 1, 1, 2, 2, 4, 3, 2, 2, 4, 1, 1, 4, 2, 3, 1, 1,\n",
      "        2, 3, 1, 4, 4, 4, 3, 3, 3, 0, 2, 1, 4, 4, 0, 4, 1, 0, 1, 4, 2, 3, 0, 1,\n",
      "        0, 2, 3, 3, 1, 2, 4, 0, 1, 1, 3, 0, 4, 2, 4, 4, 1, 2, 1, 4, 0, 1, 4, 4,\n",
      "        1, 2, 2, 1, 4, 0, 1, 1, 1, 4, 4, 4, 2, 1, 1, 3, 1, 2, 1, 4, 3, 3, 4, 2,\n",
      "        0, 3, 4, 2, 2, 2, 3, 2], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([1, 3, 1, 0, 0, 2, 3, 2, 0, 2, 3, 1, 0, 0, 1, 3, 0, 2, 0, 2, 3, 0, 2, 3,\n",
      "        2, 4, 3, 1, 0, 3, 1, 3, 3, 3, 0, 2, 3, 3, 3, 1, 3, 3, 3, 1, 2, 1, 3, 2,\n",
      "        2, 1, 3, 1, 0, 1, 3, 3, 3, 0, 2, 2, 1, 2, 0, 3, 2, 0, 3, 3, 3, 3, 0, 2,\n",
      "        0, 1, 3, 3, 2, 3, 2, 0, 1, 3, 3, 0, 2, 3, 2, 3, 3, 2, 1, 3, 0, 3, 3, 2,\n",
      "        3, 2, 2, 1, 2, 1, 2, 2, 3, 2, 3, 2, 2, 2, 0, 3, 3, 2, 3, 3, 2, 3, 3, 2,\n",
      "        0, 3, 3, 2, 2, 2, 2, 2], device='cuda:0')\n",
      "相等的结果为： tensor([0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0,\n",
      "        1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,\n",
      "        1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0,\n",
      "        1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0,\n",
      "        0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1,\n",
      "        1, 1, 0, 1, 1, 1, 0, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.3380208333333333\n",
      "============================================\n",
      "准确率由： 0.0 上升至： 0.3605769230769231 已更新并保存权值为weights/best.pkl\n",
      "第1个epoch的识别准确率为：36%\n",
      "epoch:2,loss:1.0777\n",
      "============================================\n",
      "源数据标签： tensor([3, 0, 3, 3, 3, 3, 0, 4, 1, 1, 4, 1, 3, 1, 0, 3, 0, 1, 3, 2, 3, 1, 1, 0,\n",
      "        2, 2, 4, 1, 2, 1, 4, 2, 2, 0, 0, 3, 2, 2, 3, 3, 3, 0, 4, 1, 0, 0, 2, 4,\n",
      "        1, 0, 3, 1, 4, 0, 1, 1, 0, 0, 0, 0, 3, 2, 4, 2, 1, 0, 0, 3, 2, 0, 3, 1,\n",
      "        4, 0, 2, 3, 2, 4, 3, 4, 3, 1, 0, 1, 3, 4, 3, 3, 4, 2, 1, 0, 4, 1, 1, 1,\n",
      "        4, 3, 3, 2, 1, 0, 3, 4, 1, 3, 3, 1, 0, 0, 3, 1, 3, 0, 4, 3, 3, 0, 3, 2,\n",
      "        0, 1, 3, 3, 1, 3, 3, 2], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([1, 0, 1, 3, 3, 2, 0, 1, 3, 3, 1, 1, 3, 1, 0, 1, 0, 3, 3, 2, 1, 2, 1, 0,\n",
      "        2, 1, 1, 3, 2, 2, 3, 0, 2, 0, 0, 1, 1, 2, 1, 2, 3, 0, 3, 1, 0, 0, 2, 2,\n",
      "        1, 0, 1, 1, 2, 0, 3, 1, 0, 0, 0, 0, 1, 1, 1, 1, 3, 0, 0, 1, 2, 0, 3, 3,\n",
      "        2, 0, 2, 3, 2, 3, 3, 1, 3, 2, 0, 3, 1, 3, 1, 1, 2, 2, 2, 0, 3, 2, 3, 2,\n",
      "        2, 3, 1, 3, 1, 0, 3, 1, 2, 2, 3, 1, 0, 1, 1, 2, 2, 0, 1, 3, 3, 0, 3, 2,\n",
      "        0, 1, 1, 1, 2, 2, 1, 2], device='cuda:0')\n",
      "相等的结果为： tensor([0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1,\n",
      "        1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0,\n",
      "        1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0,\n",
      "        0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0,\n",
      "        0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1,\n",
      "        1, 1, 0, 0, 0, 0, 0, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.46848958333333335\n",
      "============================================\n",
      "准确率由： 0.3605769230769231 上升至： 0.47155448717948717 已更新并保存权值为weights/best.pkl\n",
      "第2个epoch的识别准确率为：47%\n",
      "epoch:3,loss:1.0791\n",
      "============================================\n",
      "源数据标签： tensor([1, 3, 3, 3, 3, 3, 1, 0, 2, 1, 2, 4, 2, 2, 2, 3, 1, 3, 3, 2, 0, 1, 2, 3,\n",
      "        3, 1, 2, 2, 1, 1, 3, 3, 0, 0, 2, 3, 0, 4, 1, 2, 2, 2, 4, 3, 3, 1, 2, 0,\n",
      "        2, 0, 1, 2, 3, 0, 0, 3, 1, 1, 3, 3, 0, 4, 3, 0, 0, 2, 0, 3, 3, 0, 0, 3,\n",
      "        1, 1, 0, 1, 2, 3, 1, 0, 2, 2, 3, 2, 0, 2, 2, 3, 0, 1, 2, 1, 2, 4, 4, 1,\n",
      "        1, 4, 3, 3, 3, 0, 4, 4, 1, 4, 3, 2, 0, 0, 2, 2, 1, 4, 1, 0, 4, 2, 2, 0,\n",
      "        4, 3, 1, 0, 2, 1, 2, 4], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([1, 0, 0, 1, 1, 1, 2, 0, 1, 1, 2, 3, 2, 0, 0, 1, 1, 3, 1, 2, 0, 1, 2, 1,\n",
      "        1, 0, 2, 2, 1, 2, 4, 1, 0, 0, 2, 1, 0, 1, 1, 2, 0, 2, 1, 2, 1, 1, 0, 0,\n",
      "        2, 0, 1, 2, 1, 0, 4, 1, 2, 1, 1, 2, 0, 3, 2, 0, 0, 2, 0, 1, 1, 0, 0, 1,\n",
      "        1, 1, 0, 1, 2, 1, 3, 0, 1, 1, 1, 2, 1, 0, 2, 1, 0, 2, 2, 1, 2, 2, 1, 1,\n",
      "        3, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 2, 0, 0, 2, 0, 1, 1, 1, 0, 3, 2, 4, 0,\n",
      "        2, 1, 2, 0, 0, 1, 2, 2], device='cuda:0')\n",
      "相等的结果为： tensor([1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0,\n",
      "        0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1,\n",
      "        1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0,\n",
      "        1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1,\n",
      "        0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1,\n",
      "        0, 0, 0, 1, 0, 1, 1, 0], device='cuda:0', dtype=torch.uint8)\n",
      "0.50859375\n",
      "============================================\n",
      "准确率由： 0.47155448717948717 上升至： 0.5150240384615384 已更新并保存权值为weights/best.pkl\n",
      "第3个epoch的识别准确率为：51%\n",
      "epoch:4,loss:1.0097\n",
      "============================================\n",
      "源数据标签： tensor([2, 3, 2, 1, 2, 3, 0, 3, 2, 4, 2, 3, 3, 3, 1, 2, 4, 3, 0, 2, 3, 4, 1, 0,\n",
      "        2, 1, 1, 2, 2, 2, 0, 4, 3, 1, 1, 4, 1, 4, 4, 1, 0, 2, 2, 4, 1, 2, 1, 2,\n",
      "        0, 2, 3, 1, 4, 2, 1, 0, 0, 2, 3, 2, 2, 2, 1, 4, 4, 2, 1, 2, 3, 2, 3, 1,\n",
      "        1, 3, 3, 2, 4, 4, 2, 1, 3, 3, 3, 1, 3, 0, 0, 3, 4, 4, 4, 2, 1, 1, 4, 2,\n",
      "        0, 3, 4, 1, 2, 4, 2, 2, 0, 0, 2, 4, 4, 3, 1, 1, 0, 3, 3, 1, 1, 3, 1, 1,\n",
      "        0, 1, 1, 0, 4, 0, 1, 0], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([2, 2, 1, 3, 2, 4, 0, 2, 1, 3, 0, 4, 3, 3, 1, 1, 1, 4, 0, 1, 3, 3, 1, 0,\n",
      "        2, 1, 1, 1, 2, 2, 0, 1, 1, 0, 1, 4, 1, 3, 4, 1, 0, 2, 0, 1, 1, 1, 1, 1,\n",
      "        0, 2, 1, 1, 1, 2, 1, 0, 0, 2, 1, 2, 2, 2, 1, 0, 1, 2, 1, 2, 3, 2, 1, 2,\n",
      "        2, 1, 1, 2, 1, 1, 2, 4, 3, 1, 1, 1, 1, 0, 0, 1, 1, 4, 4, 1, 1, 1, 2, 1,\n",
      "        0, 4, 3, 0, 2, 4, 2, 2, 0, 0, 2, 1, 2, 1, 2, 1, 0, 1, 3, 1, 1, 3, 1, 4,\n",
      "        0, 3, 1, 0, 1, 0, 1, 0], device='cuda:0')\n",
      "相等的结果为： tensor([1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1,\n",
      "        1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0,\n",
      "        1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0,\n",
      "        0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0,\n",
      "        1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0,\n",
      "        1, 0, 1, 1, 0, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.5453125\n",
      "============================================\n",
      "准确率由： 0.5150240384615384 上升至： 0.5494791666666666 已更新并保存权值为weights/best.pkl\n",
      "第4个epoch的识别准确率为：54%\n",
      "epoch:5,loss:0.9745\n",
      "============================================\n",
      "源数据标签： tensor([2, 2, 4, 0, 0, 1, 3, 1, 2, 0, 1, 3, 1, 0, 2, 4, 4, 4, 2, 3, 2, 4, 0, 1,\n",
      "        1, 0, 1, 1, 1, 2, 3, 4, 0, 3, 4, 3, 3, 1, 0, 1, 0, 3, 2, 3, 0, 2, 3, 2,\n",
      "        4, 2, 1, 2, 3, 3, 4, 4, 0, 3, 3, 2, 1, 2, 4, 2, 3, 3, 4, 0, 1, 2, 4, 2,\n",
      "        3, 3, 1, 1, 4, 1, 3, 4, 4, 0, 4, 2, 4, 1, 1, 3, 3, 3, 4, 3, 4, 1, 0, 0,\n",
      "        2, 2, 1, 3, 1, 3, 2, 2, 2, 1, 2, 3, 4, 3, 4, 4, 0, 0, 2, 2, 0, 3, 0, 1,\n",
      "        4, 2, 2, 4, 4, 1, 4, 1], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([2, 2, 4, 0, 0, 1, 3, 4, 0, 0, 1, 3, 2, 0, 2, 1, 1, 4, 2, 1, 2, 1, 0, 1,\n",
      "        0, 0, 1, 3, 2, 2, 4, 4, 0, 3, 2, 1, 3, 4, 0, 1, 4, 3, 1, 3, 0, 2, 1, 2,\n",
      "        4, 4, 1, 2, 4, 4, 1, 4, 0, 4, 1, 2, 4, 2, 4, 2, 4, 4, 4, 0, 1, 0, 1, 1,\n",
      "        4, 4, 1, 1, 4, 1, 1, 4, 4, 0, 1, 2, 4, 1, 1, 4, 1, 1, 1, 4, 3, 4, 0, 0,\n",
      "        2, 0, 1, 1, 1, 4, 2, 2, 2, 1, 2, 3, 2, 3, 2, 2, 0, 0, 3, 1, 0, 1, 0, 1,\n",
      "        2, 2, 2, 4, 2, 1, 1, 1], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1,\n",
      "        0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1,\n",
      "        1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0,\n",
      "        0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1,\n",
      "        1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1,\n",
      "        0, 1, 1, 1, 0, 1, 0, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.5963541666666666\n",
      "============================================\n",
      "准确率由： 0.5494791666666666 上升至： 0.5943509615384616 已更新并保存权值为weights/best.pkl\n",
      "第5个epoch的识别准确率为：59%\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "epoch:6,loss:0.7636\n",
      "============================================\n",
      "源数据标签： tensor([1, 1, 0, 0, 3, 4, 0, 3, 4, 0, 0, 4, 0, 0, 0, 1, 1, 2, 3, 0, 1, 1, 1, 4,\n",
      "        4, 4, 0, 0, 2, 4, 4, 1, 4, 0, 3, 4, 2, 3, 1, 3, 2, 4, 3, 1, 4, 4, 2, 0,\n",
      "        4, 4, 1, 2, 0, 3, 1, 3, 2, 3, 2, 2, 2, 3, 2, 4, 1, 3, 2, 0, 4, 1, 3, 4,\n",
      "        4, 1, 0, 3, 2, 0, 3, 0, 0, 4, 1, 1, 1, 0, 0, 0, 3, 0, 1, 2, 4, 4, 2, 1,\n",
      "        2, 3, 1, 0, 2, 1, 2, 2, 2, 4, 3, 4, 3, 2, 1, 1, 2, 3, 2, 2, 4, 2, 1, 2,\n",
      "        1, 1, 2, 2, 0, 1, 4, 1], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([1, 2, 0, 0, 3, 4, 0, 3, 1, 0, 0, 3, 0, 0, 0, 4, 4, 1, 3, 0, 1, 1, 3, 4,\n",
      "        2, 2, 0, 0, 2, 3, 1, 1, 1, 0, 3, 4, 2, 4, 1, 4, 2, 1, 1, 1, 1, 1, 2, 0,\n",
      "        1, 2, 1, 2, 0, 3, 1, 4, 2, 3, 2, 2, 2, 4, 2, 3, 3, 2, 2, 2, 3, 1, 4, 4,\n",
      "        4, 1, 0, 3, 2, 0, 3, 0, 0, 4, 1, 1, 1, 0, 0, 0, 3, 0, 1, 2, 4, 3, 2, 3,\n",
      "        2, 3, 1, 0, 2, 0, 2, 2, 2, 1, 3, 4, 3, 2, 1, 3, 2, 2, 2, 2, 4, 2, 4, 2,\n",
      "        1, 3, 2, 2, 0, 1, 1, 1], device='cuda:0')\n",
      "相等的结果为： tensor([1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1,\n",
      "        0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1,\n",
      "        0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0,\n",
      "        1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1,\n",
      "        1, 0, 1, 1, 1, 1, 0, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.621875\n",
      "============================================\n",
      "准确率由： 0.5943509615384616 上升至： 0.6191907051282052 已更新并保存权值为weights/best.pkl\n",
      "第6个epoch的识别准确率为：61%\n",
      "epoch:7,loss:0.8154\n",
      "============================================\n",
      "源数据标签： tensor([0, 0, 0, 4, 1, 1, 3, 1, 2, 3, 4, 0, 0, 1, 2, 1, 0, 4, 4, 1, 2, 4, 2, 1,\n",
      "        0, 4, 0, 2, 3, 4, 2, 3, 1, 3, 2, 3, 4, 3, 4, 2, 1, 3, 3, 4, 1, 3, 0, 0,\n",
      "        2, 4, 4, 1, 2, 4, 3, 3, 0, 3, 1, 1, 2, 1, 2, 0, 3, 2, 2, 4, 4, 1, 3, 2,\n",
      "        0, 1, 0, 1, 3, 3, 0, 3, 1, 0, 1, 1, 0, 1, 4, 1, 3, 4, 1, 4, 0, 1, 1, 0,\n",
      "        1, 4, 4, 3, 1, 1, 2, 4, 0, 1, 4, 3, 1, 4, 1, 0, 4, 2, 1, 2, 0, 2, 1, 1,\n",
      "        1, 2, 4, 4, 3, 2, 0, 1], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([0, 0, 0, 4, 2, 1, 3, 1, 4, 1, 4, 0, 0, 1, 2, 1, 0, 4, 4, 1, 2, 1, 2, 3,\n",
      "        0, 4, 2, 3, 1, 3, 2, 4, 3, 1, 2, 1, 4, 1, 4, 2, 3, 2, 3, 3, 4, 3, 0, 0,\n",
      "        4, 3, 1, 1, 2, 4, 1, 1, 0, 3, 1, 1, 2, 2, 2, 0, 1, 2, 2, 1, 4, 4, 3, 4,\n",
      "        0, 2, 0, 1, 4, 1, 0, 3, 1, 0, 1, 1, 0, 1, 1, 1, 3, 4, 4, 4, 0, 1, 1, 0,\n",
      "        1, 4, 4, 3, 1, 4, 2, 1, 0, 1, 2, 1, 3, 1, 3, 0, 1, 2, 1, 1, 0, 1, 1, 4,\n",
      "        1, 2, 4, 1, 4, 2, 0, 1], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0,\n",
      "        1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1,\n",
      "        0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0,\n",
      "        1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0,\n",
      "        1, 1, 1, 0, 0, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.6611979166666667\n",
      "============================================\n",
      "准确率由： 0.6191907051282052 上升至： 0.6542467948717948 已更新并保存权值为weights/best.pkl\n",
      "第7个epoch的识别准确率为：65%\n",
      "epoch:8,loss:0.6923\n",
      "============================================\n",
      "源数据标签： tensor([3, 4, 3, 1, 4, 2, 4, 3, 0, 2, 2, 0, 3, 1, 1, 0, 3, 1, 2, 2, 0, 4, 3, 4,\n",
      "        2, 3, 4, 2, 1, 1, 1, 4, 2, 1, 0, 1, 0, 1, 1, 4, 1, 2, 4, 2, 4, 1, 3, 1,\n",
      "        0, 3, 4, 3, 3, 2, 0, 0, 1, 4, 0, 3, 3, 3, 4, 4, 3, 0, 2, 4, 2, 1, 0, 1,\n",
      "        3, 4, 3, 0, 1, 0, 3, 1, 3, 1, 4, 3, 4, 3, 1, 4, 4, 4, 1, 4, 1, 1, 3, 1,\n",
      "        4, 0, 4, 1, 1, 3, 3, 1, 4, 2, 0, 3, 3, 1, 0, 2, 1, 0, 2, 2, 2, 3, 2, 2,\n",
      "        3, 0, 0, 1, 0, 3, 3, 3], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([1, 4, 1, 1, 3, 2, 4, 3, 0, 0, 2, 0, 3, 2, 1, 0, 3, 1, 2, 2, 0, 4, 1, 4,\n",
      "        1, 1, 1, 2, 1, 1, 1, 4, 2, 1, 0, 1, 0, 3, 1, 2, 3, 2, 4, 2, 2, 1, 4, 1,\n",
      "        0, 4, 4, 3, 3, 2, 0, 0, 1, 4, 0, 3, 3, 1, 4, 4, 3, 0, 2, 1, 2, 3, 0, 3,\n",
      "        2, 3, 4, 0, 2, 0, 1, 4, 4, 4, 4, 3, 4, 3, 1, 1, 4, 4, 1, 1, 1, 4, 3, 1,\n",
      "        4, 0, 4, 3, 1, 4, 1, 1, 4, 2, 0, 3, 3, 1, 0, 1, 1, 0, 2, 2, 2, 3, 2, 2,\n",
      "        1, 0, 0, 2, 0, 3, 3, 1], device='cuda:0')\n",
      "相等的结果为： tensor([0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1,\n",
      "        0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1,\n",
      "        1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0,\n",
      "        0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1,\n",
      "        1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        0, 1, 1, 0, 1, 1, 1, 0], device='cuda:0', dtype=torch.uint8)\n",
      "0.7033854166666667\n",
      "============================================\n",
      "准确率由： 0.6542467948717948 上升至： 0.7005208333333334 已更新并保存权值为weights/best.pkl\n",
      "第8个epoch的识别准确率为：70%\n",
      "epoch:9,loss:0.5946\n",
      "============================================\n",
      "源数据标签： tensor([3, 2, 3, 4, 1, 0, 0, 4, 2, 2, 1, 3, 0, 4, 0, 1, 2, 0, 1, 3, 3, 4, 1, 1,\n",
      "        4, 4, 0, 3, 0, 1, 4, 3, 1, 0, 3, 0, 4, 0, 1, 1, 1, 3, 2, 1, 4, 1, 2, 1,\n",
      "        2, 1, 1, 3, 4, 3, 1, 3, 1, 2, 1, 2, 3, 3, 4, 0, 0, 0, 2, 3, 1, 1, 3, 3,\n",
      "        0, 1, 2, 0, 4, 4, 1, 4, 4, 4, 0, 4, 2, 4, 2, 1, 2, 2, 0, 0, 1, 3, 1, 0,\n",
      "        3, 0, 2, 2, 0, 1, 1, 3, 0, 2, 4, 0, 0, 0, 3, 3, 1, 1, 0, 0, 2, 4, 3, 3,\n",
      "        4, 3, 1, 3, 2, 3, 1, 2], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([3, 2, 1, 4, 1, 0, 0, 4, 2, 1, 1, 3, 0, 1, 0, 1, 2, 0, 2, 3, 4, 4, 3, 2,\n",
      "        4, 2, 0, 3, 0, 1, 1, 3, 3, 0, 4, 0, 4, 0, 1, 1, 1, 3, 2, 1, 1, 1, 2, 2,\n",
      "        2, 1, 3, 3, 4, 3, 4, 4, 4, 2, 4, 2, 4, 3, 4, 0, 0, 0, 2, 3, 1, 1, 3, 4,\n",
      "        0, 1, 2, 0, 4, 4, 1, 4, 4, 2, 0, 4, 2, 2, 2, 1, 2, 2, 0, 2, 1, 3, 1, 0,\n",
      "        3, 4, 2, 2, 0, 1, 1, 3, 0, 1, 4, 0, 0, 0, 4, 3, 3, 1, 0, 0, 2, 4, 3, 3,\n",
      "        2, 4, 1, 1, 2, 3, 1, 2], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0,\n",
      "        1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0,\n",
      "        1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1,\n",
      "        1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1,\n",
      "        0, 0, 1, 0, 1, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.7375\n",
      "============================================\n",
      "准确率由： 0.7005208333333334 上升至： 0.7411858974358975 已更新并保存权值为weights/best.pkl\n",
      "第9个epoch的识别准确率为：74%\n",
      "epoch:10,loss:0.7858\n",
      "============================================\n",
      "源数据标签： tensor([2, 3, 3, 1, 4, 3, 2, 1, 2, 1, 4, 1, 2, 3, 1, 4, 2, 3, 1, 4, 3, 3, 4, 3,\n",
      "        4, 4, 1, 2, 1, 2, 1, 2, 3, 4, 4, 3, 4, 1, 3, 1, 3, 3, 2, 0, 2, 3, 1, 1,\n",
      "        2, 3, 0, 2, 4, 2, 1, 1, 3, 1, 2, 3, 2, 2, 2, 0, 4, 3, 3, 0, 2, 0, 4, 1,\n",
      "        1, 0, 2, 3, 2, 4, 1, 3, 2, 3, 2, 0, 1, 0, 3, 3, 4, 2, 3, 1, 2, 0, 3, 3,\n",
      "        2, 0, 3, 0, 0, 1, 4, 1, 0, 2, 0, 3, 3, 3, 4, 1, 0, 3, 4, 4, 3, 3, 2, 1,\n",
      "        2, 0, 2, 2, 2, 2, 0, 0], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([2, 3, 3, 4, 4, 3, 2, 1, 2, 1, 4, 4, 2, 3, 3, 3, 1, 1, 1, 4, 1, 3, 4, 3,\n",
      "        1, 2, 1, 2, 2, 2, 4, 2, 4, 3, 4, 3, 3, 0, 1, 1, 3, 4, 2, 0, 2, 3, 2, 1,\n",
      "        2, 3, 1, 2, 4, 2, 4, 1, 3, 1, 2, 3, 2, 0, 2, 0, 4, 1, 3, 0, 2, 2, 2, 1,\n",
      "        4, 0, 4, 3, 3, 4, 4, 3, 2, 3, 2, 0, 2, 0, 1, 3, 4, 2, 4, 1, 4, 0, 3, 3,\n",
      "        2, 0, 1, 0, 0, 1, 4, 1, 0, 2, 0, 3, 3, 3, 4, 1, 0, 2, 2, 4, 0, 2, 2, 1,\n",
      "        2, 0, 2, 2, 2, 1, 0, 0], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1,\n",
      "        0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1,\n",
      "        1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1,\n",
      "        0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1,\n",
      "        1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1,\n",
      "        1, 1, 1, 1, 1, 0, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.75859375\n",
      "============================================\n",
      "准确率由： 0.7411858974358975 上升至： 0.7580128205128205 已更新并保存权值为weights/best.pkl\n",
      "第10个epoch的识别准确率为：75%\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "epoch:11,loss:0.5265\n",
      "============================================\n",
      "源数据标签： tensor([0, 4, 2, 4, 3, 3, 4, 1, 0, 2, 2, 0, 0, 4, 3, 3, 1, 3, 2, 1, 3, 1, 4, 0,\n",
      "        1, 2, 1, 2, 4, 0, 2, 1, 2, 3, 3, 4, 2, 4, 4, 1, 4, 3, 2, 0, 3, 3, 4, 4,\n",
      "        1, 1, 3, 2, 3, 0, 3, 1, 1, 2, 1, 4, 1, 4, 2, 3, 2, 1, 0, 2, 0, 3, 2, 1,\n",
      "        1, 2, 1, 4, 3, 0, 0, 3, 2, 0, 3, 4, 1, 1, 3, 2, 1, 4, 0, 4, 4, 0, 3, 3,\n",
      "        3, 2, 4, 4, 1, 2, 0, 0, 0, 1, 2, 1, 4, 3, 3, 0, 1, 3, 0, 2, 2, 0, 3, 0,\n",
      "        3, 2, 2, 1, 2, 4, 2, 0], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([2, 4, 2, 3, 3, 3, 3, 1, 0, 3, 3, 0, 0, 3, 3, 2, 1, 2, 2, 1, 3, 1, 4, 0,\n",
      "        1, 2, 1, 2, 4, 0, 2, 1, 2, 3, 3, 1, 2, 4, 4, 1, 3, 3, 2, 0, 3, 3, 1, 4,\n",
      "        3, 1, 2, 2, 2, 0, 3, 1, 1, 2, 1, 2, 1, 4, 2, 3, 2, 1, 0, 2, 0, 3, 2, 1,\n",
      "        1, 2, 1, 3, 1, 0, 0, 3, 2, 0, 3, 1, 1, 3, 3, 2, 1, 4, 0, 4, 4, 0, 3, 3,\n",
      "        3, 2, 4, 3, 1, 2, 0, 0, 0, 2, 2, 1, 1, 3, 3, 0, 4, 1, 0, 2, 2, 0, 3, 0,\n",
      "        3, 2, 2, 1, 3, 3, 2, 0], device='cuda:0')\n",
      "相等的结果为： tensor([0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1,\n",
      "        0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 0, 0, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.80859375\n",
      "============================================\n",
      "准确率由： 0.7580128205128205 上升至： 0.7970753205128205 已更新并保存权值为weights/best.pkl\n",
      "第11个epoch的识别准确率为：79%\n",
      "epoch:12,loss:0.3851\n",
      "============================================\n",
      "源数据标签： tensor([2, 3, 1, 0, 2, 3, 1, 2, 2, 4, 2, 3, 1, 4, 4, 1, 2, 4, 2, 3, 3, 0, 1, 0,\n",
      "        1, 4, 2, 2, 2, 0, 0, 4, 0, 3, 4, 1, 1, 2, 0, 1, 3, 0, 1, 2, 0, 2, 3, 3,\n",
      "        4, 4, 3, 4, 1, 2, 4, 1, 3, 4, 3, 3, 0, 2, 4, 0, 0, 0, 3, 3, 2, 2, 1, 2,\n",
      "        1, 3, 4, 1, 1, 4, 2, 3, 3, 3, 3, 4, 4, 1, 0, 0, 3, 4, 4, 3, 1, 4, 1, 0,\n",
      "        2, 1, 1, 2, 1, 0, 2, 1, 3, 3, 1, 4, 1, 2, 2, 1, 3, 3, 2, 2, 0, 2, 4, 2,\n",
      "        1, 2, 3, 0, 2, 4, 4, 0], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([2, 3, 1, 0, 2, 3, 1, 4, 2, 4, 2, 3, 1, 4, 4, 3, 2, 4, 2, 3, 3, 0, 1, 0,\n",
      "        1, 1, 2, 4, 2, 0, 0, 4, 0, 3, 3, 1, 1, 2, 0, 1, 4, 0, 1, 2, 0, 2, 4, 3,\n",
      "        3, 4, 3, 4, 1, 2, 4, 1, 3, 4, 3, 1, 0, 2, 4, 0, 0, 0, 3, 3, 2, 2, 3, 2,\n",
      "        1, 4, 4, 1, 1, 4, 2, 1, 3, 3, 4, 4, 4, 1, 0, 0, 3, 4, 3, 3, 1, 4, 4, 0,\n",
      "        2, 1, 1, 1, 1, 0, 2, 1, 4, 3, 1, 4, 4, 2, 2, 2, 2, 3, 2, 2, 0, 2, 4, 4,\n",
      "        1, 2, 3, 0, 2, 4, 4, 0], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1,\n",
      "        0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1,\n",
      "        1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1,\n",
      "        1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.8200520833333333\n",
      "============================================\n",
      "准确率由： 0.7970753205128205 上升至： 0.8223157051282052 已更新并保存权值为weights/best.pkl\n",
      "第12个epoch的识别准确率为：82%\n",
      "epoch:13,loss:0.3791\n",
      "============================================\n",
      "源数据标签： tensor([3, 3, 1, 1, 3, 1, 3, 2, 0, 4, 4, 3, 0, 1, 2, 1, 2, 1, 3, 4, 1, 1, 2, 4,\n",
      "        1, 2, 0, 0, 3, 2, 3, 0, 2, 1, 4, 1, 1, 0, 4, 4, 2, 3, 2, 1, 0, 3, 3, 2,\n",
      "        3, 1, 0, 4, 2, 4, 4, 4, 4, 1, 2, 0, 1, 0, 1, 3, 1, 3, 3, 1, 1, 3, 3, 4,\n",
      "        2, 3, 3, 4, 2, 1, 3, 2, 1, 0, 4, 1, 3, 1, 1, 0, 3, 1, 3, 1, 1, 2, 3, 2,\n",
      "        2, 4, 4, 1, 3, 0, 0, 1, 1, 3, 3, 0, 1, 3, 1, 3, 1, 3, 3, 2, 3, 1, 4, 4,\n",
      "        0, 0, 2, 4, 1, 2, 0, 0], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([3, 3, 1, 1, 3, 1, 3, 2, 0, 4, 1, 3, 0, 2, 2, 1, 2, 1, 4, 4, 1, 1, 2, 4,\n",
      "        1, 2, 0, 0, 3, 2, 3, 0, 2, 1, 4, 1, 1, 0, 4, 2, 2, 3, 2, 1, 0, 3, 3, 2,\n",
      "        3, 1, 0, 4, 2, 4, 4, 3, 4, 1, 2, 0, 1, 0, 1, 3, 1, 3, 3, 1, 2, 3, 3, 4,\n",
      "        2, 3, 3, 4, 2, 1, 3, 2, 1, 0, 3, 1, 3, 1, 1, 0, 1, 1, 3, 1, 1, 2, 3, 2,\n",
      "        2, 4, 4, 1, 3, 0, 0, 1, 1, 4, 4, 0, 1, 3, 1, 3, 1, 3, 0, 2, 3, 1, 2, 1,\n",
      "        0, 0, 2, 4, 4, 2, 0, 0], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0,\n",
      "        1, 1, 1, 1, 0, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.8536458333333333\n",
      "============================================\n",
      "准确率由： 0.8223157051282052 上升至： 0.8465544871794872 已更新并保存权值为weights/best.pkl\n",
      "第13个epoch的识别准确率为：84%\n",
      "epoch:14,loss:0.4600\n",
      "============================================\n",
      "源数据标签： tensor([1, 0, 0, 2, 2, 1, 1, 4, 3, 3, 1, 0, 1, 3, 3, 1, 1, 0, 2, 3, 4, 0, 1, 4,\n",
      "        2, 2, 1, 4, 3, 2, 2, 3, 2, 0, 0, 1, 0, 1, 3, 1, 1, 1, 3, 2, 0, 3, 2, 2,\n",
      "        1, 3, 0, 3, 2, 2, 0, 1, 3, 1, 2, 2, 0, 1, 3, 4, 1, 3, 4, 4, 0, 2, 0, 1,\n",
      "        4, 1, 4, 4, 2, 3, 1, 1, 2, 4, 1, 4, 4, 3, 2, 3, 4, 2, 0, 4, 0, 4, 3, 4,\n",
      "        2, 2, 1, 2, 2, 4, 1, 0, 4, 3, 0, 1, 0, 4, 2, 3, 3, 3, 4, 1, 3, 0, 0, 4,\n",
      "        3, 1, 2, 3, 3, 4, 4, 0], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([1, 0, 0, 1, 2, 1, 1, 4, 3, 3, 4, 0, 1, 3, 3, 1, 1, 0, 4, 3, 3, 0, 1, 4,\n",
      "        2, 2, 1, 4, 3, 2, 2, 3, 2, 0, 0, 1, 0, 1, 3, 1, 1, 1, 3, 2, 0, 3, 2, 2,\n",
      "        1, 1, 0, 3, 4, 2, 0, 1, 3, 1, 2, 2, 0, 3, 3, 4, 1, 3, 3, 4, 0, 2, 0, 1,\n",
      "        4, 1, 1, 4, 2, 3, 1, 1, 2, 2, 1, 4, 4, 3, 2, 3, 4, 1, 0, 4, 0, 2, 1, 2,\n",
      "        4, 2, 1, 2, 2, 1, 1, 2, 4, 3, 0, 1, 0, 3, 2, 3, 3, 3, 4, 1, 3, 0, 0, 4,\n",
      "        3, 1, 3, 3, 1, 4, 1, 0], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1,\n",
      "        1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0,\n",
      "        0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 0, 1, 0, 1, 0, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.8768229166666667\n",
      "============================================\n",
      "准确率由： 0.8465544871794872 上升至： 0.8717948717948718 已更新并保存权值为weights/best.pkl\n",
      "第14个epoch的识别准确率为：87%\n",
      "epoch:15,loss:0.3192\n",
      "============================================\n",
      "源数据标签： tensor([2, 3, 1, 4, 2, 1, 4, 0, 3, 4, 4, 2, 4, 1, 3, 4, 1, 3, 2, 0, 0, 0, 3, 1,\n",
      "        2, 0, 3, 1, 3, 3, 0, 0, 1, 1, 3, 3, 4, 3, 1, 4, 4, 1, 2, 1, 2, 1, 0, 4,\n",
      "        3, 3, 0, 0, 0, 3, 2, 2, 3, 1, 2, 1, 1, 2, 4, 1, 3, 0, 4, 4, 1, 2, 1, 0,\n",
      "        0, 1, 4, 2, 1, 1, 1, 0, 4, 0, 2, 2, 2, 4, 1, 1, 0, 3, 3, 4, 2, 0, 1, 2,\n",
      "        3, 4, 4, 3, 1, 3, 4, 4, 4, 2, 3, 1, 4, 3, 2, 1, 1, 0, 4, 3, 0, 1, 4, 3,\n",
      "        1, 2, 0, 2, 4, 2, 0, 2], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([2, 3, 1, 4, 2, 1, 2, 0, 3, 4, 4, 2, 4, 1, 2, 1, 3, 3, 2, 0, 0, 0, 3, 3,\n",
      "        2, 0, 4, 1, 3, 4, 0, 0, 1, 1, 3, 3, 4, 3, 1, 4, 4, 3, 1, 1, 1, 4, 0, 4,\n",
      "        3, 3, 0, 0, 0, 4, 2, 2, 3, 1, 2, 1, 1, 2, 4, 1, 3, 0, 4, 4, 1, 2, 1, 2,\n",
      "        0, 3, 3, 2, 1, 1, 1, 0, 4, 0, 2, 2, 2, 4, 1, 1, 0, 3, 3, 4, 2, 0, 3, 2,\n",
      "        3, 4, 4, 1, 1, 3, 4, 4, 4, 2, 3, 1, 3, 3, 2, 1, 1, 0, 4, 3, 0, 1, 4, 1,\n",
      "        1, 2, 0, 2, 4, 1, 0, 2], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0,\n",
      "        1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1,\n",
      "        1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,\n",
      "        1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1,\n",
      "        1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,\n",
      "        1, 1, 1, 1, 1, 0, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.8953125\n",
      "============================================\n",
      "准确率由： 0.8717948717948718 上升至： 0.8822115384615384 已更新并保存权值为weights/best.pkl\n",
      "第15个epoch的识别准确率为：88%\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "epoch:16,loss:0.2822\n",
      "============================================\n",
      "源数据标签： tensor([2, 0, 4, 0, 3, 4, 0, 4, 1, 2, 0, 1, 2, 2, 4, 0, 1, 4, 3, 3, 4, 3, 3, 2,\n",
      "        1, 2, 3, 1, 3, 0, 1, 4, 3, 1, 4, 3, 4, 4, 2, 2, 3, 0, 2, 3, 1, 1, 1, 1,\n",
      "        1, 1, 3, 3, 1, 0, 3, 1, 2, 0, 1, 2, 2, 2, 1, 2, 0, 4, 0, 4, 2, 3, 3, 1,\n",
      "        1, 1, 2, 3, 0, 2, 2, 3, 3, 1, 4, 1, 3, 3, 0, 4, 4, 0, 1, 1, 3, 3, 1, 3,\n",
      "        1, 2, 2, 4, 2, 2, 2, 3, 1, 3, 3, 2, 0, 2, 1, 1, 3, 2, 0, 4, 3, 1, 1, 2,\n",
      "        4, 1, 0, 3, 1, 4, 4, 1], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([2, 0, 4, 0, 3, 4, 0, 4, 1, 2, 0, 1, 2, 2, 4, 0, 1, 4, 4, 3, 3, 1, 3, 2,\n",
      "        1, 2, 3, 1, 4, 0, 4, 4, 3, 1, 4, 3, 4, 4, 2, 2, 3, 0, 2, 1, 1, 3, 3, 1,\n",
      "        1, 1, 4, 3, 1, 0, 3, 1, 2, 0, 1, 2, 2, 2, 1, 2, 0, 2, 0, 4, 2, 3, 3, 1,\n",
      "        1, 1, 2, 3, 0, 2, 2, 3, 3, 1, 4, 1, 4, 1, 0, 4, 4, 0, 2, 3, 3, 4, 3, 3,\n",
      "        1, 2, 2, 4, 2, 2, 2, 3, 1, 3, 3, 2, 0, 2, 1, 1, 3, 2, 0, 4, 3, 1, 1, 2,\n",
      "        4, 2, 0, 3, 1, 4, 4, 1], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1,\n",
      "        1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1,\n",
      "        1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 0, 1, 1, 1, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.8856770833333333\n",
      "============================================\n",
      "准确率由： 0.8822115384615384 上升至： 0.8858173076923077 已更新并保存权值为weights/best.pkl\n",
      "第16个epoch的识别准确率为：88%\n",
      "epoch:17,loss:0.2460\n",
      "============================================\n",
      "源数据标签： tensor([4, 3, 3, 1, 2, 2, 4, 1, 0, 1, 2, 0, 2, 0, 1, 3, 3, 2, 2, 0, 4, 2, 1, 2,\n",
      "        2, 0, 0, 2, 2, 3, 3, 0, 3, 4, 0, 4, 2, 1, 3, 1, 1, 3, 1, 3, 0, 2, 0, 0,\n",
      "        1, 0, 3, 1, 0, 4, 4, 2, 2, 2, 1, 1, 2, 0, 0, 4, 1, 2, 3, 3, 3, 1, 0, 1,\n",
      "        3, 4, 1, 0, 4, 1, 2, 3, 4, 1, 4, 1, 4, 3, 4, 2, 4, 2, 3, 1, 3, 2, 3, 3,\n",
      "        1, 0, 1, 3, 4, 4, 1, 3, 4, 4, 1, 3, 0, 1, 0, 3, 1, 0, 4, 2, 0, 2, 2, 2,\n",
      "        1, 2, 1, 4, 0, 2, 3, 2], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([4, 3, 3, 1, 2, 2, 4, 1, 0, 1, 2, 0, 2, 0, 1, 3, 3, 2, 2, 0, 4, 2, 1, 2,\n",
      "        2, 0, 0, 2, 2, 3, 3, 0, 3, 4, 4, 4, 2, 1, 4, 1, 1, 3, 3, 3, 0, 4, 0, 0,\n",
      "        1, 0, 3, 4, 0, 4, 4, 2, 2, 2, 1, 1, 4, 0, 0, 4, 1, 2, 3, 3, 3, 1, 0, 1,\n",
      "        3, 4, 1, 0, 4, 1, 2, 3, 4, 1, 3, 1, 4, 3, 4, 2, 4, 2, 3, 4, 3, 2, 3, 3,\n",
      "        1, 0, 2, 3, 4, 4, 1, 3, 4, 4, 1, 3, 0, 1, 0, 3, 1, 0, 4, 2, 0, 2, 2, 2,\n",
      "        1, 2, 1, 4, 0, 2, 3, 2], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1,\n",
      "        1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1,\n",
      "        1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.90703125\n",
      "============================================\n",
      "准确率由： 0.8858173076923077 上升至： 0.905448717948718 已更新并保存权值为weights/best.pkl\n",
      "第17个epoch的识别准确率为：90%\n",
      "epoch:18,loss:0.3007\n",
      "============================================\n",
      "源数据标签： tensor([1, 1, 3, 3, 0, 3, 1, 3, 2, 0, 4, 1, 4, 1, 0, 2, 0, 2, 0, 4, 1, 3, 0, 4,\n",
      "        4, 4, 1, 4, 3, 1, 1, 2, 1, 0, 3, 3, 3, 4, 2, 1, 1, 4, 2, 3, 4, 3, 0, 4,\n",
      "        0, 3, 4, 2, 2, 4, 1, 1, 2, 2, 2, 0, 3, 4, 0, 4, 2, 3, 4, 1, 2, 3, 1, 3,\n",
      "        1, 4, 2, 0, 3, 1, 2, 2, 4, 2, 2, 3, 2, 4, 2, 2, 3, 2, 3, 1, 3, 3, 3, 3,\n",
      "        4, 4, 0, 4, 0, 2, 2, 0, 1, 0, 2, 2, 3, 2, 1, 3, 3, 1, 1, 3, 4, 4, 1, 2,\n",
      "        3, 2, 4, 4, 2, 2, 0, 2], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([1, 1, 3, 3, 0, 3, 1, 3, 2, 0, 2, 1, 4, 1, 0, 2, 0, 2, 0, 4, 1, 4, 0, 4,\n",
      "        4, 4, 2, 2, 1, 1, 1, 2, 1, 0, 3, 3, 3, 4, 2, 1, 1, 4, 2, 3, 4, 3, 0, 4,\n",
      "        0, 1, 4, 2, 2, 3, 3, 1, 2, 2, 1, 0, 3, 4, 0, 4, 2, 3, 4, 1, 2, 3, 1, 3,\n",
      "        1, 4, 2, 0, 1, 1, 2, 2, 4, 2, 1, 3, 2, 3, 2, 4, 3, 2, 3, 1, 3, 3, 3, 3,\n",
      "        4, 3, 0, 4, 0, 2, 2, 0, 1, 0, 2, 2, 3, 2, 1, 3, 4, 1, 1, 3, 4, 4, 1, 2,\n",
      "        4, 2, 4, 4, 0, 2, 0, 2], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1,\n",
      "        1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1,\n",
      "        0, 1, 1, 1, 0, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.9192708333333334\n",
      "============================================\n",
      "准确率由： 0.905448717948718 上升至： 0.9184695512820513 已更新并保存权值为weights/best.pkl\n",
      "第18个epoch的识别准确率为：91%\n",
      "epoch:19,loss:0.2810\n",
      "============================================\n",
      "源数据标签： tensor([0, 0, 2, 3, 1, 1, 3, 2, 2, 4, 4, 1, 4, 0, 3, 2, 3, 2, 2, 2, 2, 2, 0, 0,\n",
      "        1, 2, 3, 2, 0, 3, 3, 3, 0, 2, 3, 1, 0, 2, 2, 0, 2, 1, 4, 3, 2, 4, 3, 1,\n",
      "        1, 0, 2, 1, 0, 4, 2, 0, 3, 1, 2, 3, 3, 2, 1, 0, 1, 2, 3, 3, 2, 2, 4, 4,\n",
      "        2, 4, 4, 1, 1, 4, 0, 1, 4, 1, 2, 4, 3, 2, 0, 3, 4, 3, 1, 2, 3, 1, 1, 1,\n",
      "        1, 1, 2, 3, 2, 0, 3, 3, 3, 3, 3, 1, 1, 0, 2, 2, 2, 0, 1, 2, 0, 1, 2, 3,\n",
      "        3, 0, 0, 0, 2, 4, 3, 0], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([0, 0, 2, 3, 2, 1, 4, 2, 1, 4, 4, 1, 4, 0, 3, 2, 4, 2, 2, 2, 1, 2, 0, 0,\n",
      "        1, 2, 3, 2, 0, 3, 3, 3, 0, 3, 3, 1, 0, 3, 2, 0, 2, 1, 1, 3, 2, 3, 1, 1,\n",
      "        1, 0, 2, 1, 0, 4, 2, 0, 3, 1, 2, 3, 3, 2, 1, 0, 1, 2, 3, 3, 2, 2, 4, 4,\n",
      "        2, 4, 3, 1, 1, 4, 0, 1, 4, 1, 2, 4, 3, 2, 0, 3, 4, 4, 1, 2, 4, 1, 1, 1,\n",
      "        1, 1, 2, 3, 2, 0, 3, 3, 3, 1, 3, 1, 1, 0, 2, 2, 2, 0, 1, 2, 0, 1, 2, 3,\n",
      "        3, 0, 0, 0, 2, 4, 3, 0], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.9208333333333333\n",
      "============================================\n",
      "准确率由： 0.9184695512820513 上升至： 0.9198717948717948 已更新并保存权值为weights/best.pkl\n",
      "第19个epoch的识别准确率为：91%\n",
      "epoch:20,loss:0.1153\n",
      "============================================\n",
      "源数据标签： tensor([3, 1, 1, 0, 2, 4, 1, 1, 4, 3, 0, 3, 2, 3, 1, 3, 0, 2, 3, 3, 2, 4, 3, 1,\n",
      "        4, 4, 3, 4, 1, 2, 0, 1, 4, 1, 1, 1, 3, 1, 0, 1, 1, 4, 3, 2, 0, 1, 4, 1,\n",
      "        0, 4, 2, 1, 3, 1, 2, 0, 2, 4, 0, 1, 2, 4, 4, 1, 4, 1, 1, 4, 1, 2, 4, 3,\n",
      "        2, 2, 2, 1, 1, 2, 3, 0, 0, 3, 3, 4, 3, 0, 0, 0, 1, 2, 3, 3, 2, 1, 1, 4,\n",
      "        3, 1, 2, 3, 4, 1, 3, 4, 2, 3, 1, 0, 0, 1, 2, 0, 2, 2, 2, 1, 1, 3, 3, 0,\n",
      "        3, 1, 3, 3, 4, 0, 3, 0], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([3, 1, 1, 0, 2, 4, 1, 1, 2, 3, 0, 3, 2, 3, 2, 3, 0, 2, 3, 3, 2, 4, 3, 1,\n",
      "        4, 4, 3, 4, 1, 2, 0, 1, 4, 1, 1, 1, 3, 1, 0, 1, 1, 4, 3, 2, 0, 1, 4, 1,\n",
      "        0, 4, 2, 3, 3, 1, 2, 0, 2, 4, 0, 1, 2, 4, 4, 1, 3, 1, 1, 4, 1, 2, 4, 3,\n",
      "        2, 2, 2, 1, 1, 2, 3, 0, 0, 3, 3, 4, 3, 0, 0, 0, 1, 2, 3, 3, 2, 1, 1, 4,\n",
      "        3, 1, 2, 3, 4, 1, 3, 4, 2, 3, 1, 0, 0, 1, 2, 0, 2, 2, 2, 1, 1, 3, 3, 0,\n",
      "        3, 1, 3, 3, 4, 0, 3, 0], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.9239583333333333\n",
      "============================================\n",
      "准确率由： 0.9198717948717948 上升至： 0.9214743589743589 已更新并保存权值为weights/best.pkl\n",
      "第20个epoch的识别准确率为：92%\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "epoch:21,loss:0.5960\n",
      "============================================\n",
      "源数据标签： tensor([4, 1, 3, 3, 4, 0, 0, 3, 2, 4, 0, 3, 4, 1, 4, 0, 3, 1, 1, 3, 0, 0, 4, 4,\n",
      "        4, 1, 0, 4, 4, 1, 1, 3, 0, 3, 4, 3, 2, 3, 4, 1, 1, 4, 4, 4, 4, 4, 2, 3,\n",
      "        4, 4, 4, 2, 4, 2, 0, 1, 3, 1, 0, 0, 1, 1, 1, 4, 0, 2, 2, 2, 3, 0, 2, 2,\n",
      "        4, 2, 0, 2, 1, 1, 1, 1, 1, 3, 3, 2, 3, 3, 3, 0, 2, 0, 4, 4, 2, 1, 1, 1,\n",
      "        1, 0, 3, 0, 3, 2, 2, 0, 2, 3, 2, 4, 0, 0, 1, 2, 1, 3, 0, 3, 3, 0, 3, 4,\n",
      "        4, 2, 4, 1, 1, 2, 2, 3], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([4, 1, 3, 1, 3, 0, 0, 3, 2, 4, 0, 3, 4, 1, 4, 0, 3, 1, 3, 3, 0, 0, 4, 3,\n",
      "        4, 1, 0, 4, 3, 1, 1, 3, 0, 3, 2, 3, 2, 3, 4, 1, 2, 4, 4, 4, 4, 4, 2, 3,\n",
      "        4, 4, 4, 2, 1, 2, 0, 1, 3, 1, 0, 0, 1, 1, 1, 4, 0, 2, 4, 2, 3, 0, 2, 2,\n",
      "        3, 2, 0, 2, 1, 3, 1, 2, 1, 3, 4, 2, 4, 4, 1, 0, 2, 0, 2, 4, 2, 1, 1, 2,\n",
      "        1, 0, 3, 0, 1, 1, 4, 0, 2, 3, 4, 4, 2, 0, 1, 2, 1, 3, 0, 3, 3, 0, 3, 1,\n",
      "        3, 1, 4, 4, 4, 2, 2, 3], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0,\n",
      "        1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1,\n",
      "        0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0,\n",
      "        1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,\n",
      "        0, 0, 1, 0, 0, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.9364583333333333\n",
      "============================================\n",
      "准确率由： 0.9214743589743589 上升至： 0.9352964743589743 已更新并保存权值为weights/best.pkl\n",
      "第21个epoch的识别准确率为：93%\n",
      "epoch:22,loss:0.2073\n",
      "============================================\n",
      "源数据标签： tensor([4, 2, 3, 1, 3, 2, 2, 4, 1, 0, 0, 0, 2, 0, 1, 2, 1, 1, 1, 4, 1, 3, 0, 3,\n",
      "        1, 3, 4, 0, 1, 4, 0, 3, 2, 2, 2, 3, 1, 0, 3, 3, 1, 3, 1, 3, 4, 4, 1, 0,\n",
      "        3, 1, 2, 1, 0, 4, 1, 2, 1, 1, 0, 3, 2, 3, 4, 3, 4, 4, 3, 2, 4, 0, 4, 1,\n",
      "        3, 4, 0, 0, 0, 2, 3, 2, 1, 3, 2, 2, 2, 4, 3, 1, 3, 0, 2, 3, 1, 0, 3, 2,\n",
      "        3, 0, 1, 1, 3, 2, 2, 1, 2, 3, 1, 0, 2, 3, 1, 2, 1, 2, 4, 4, 3, 2, 0, 4,\n",
      "        2, 2, 2, 0, 3, 3, 1, 1], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([4, 4, 4, 1, 3, 2, 2, 4, 1, 0, 0, 0, 2, 0, 3, 2, 1, 1, 1, 4, 1, 3, 0, 3,\n",
      "        1, 3, 4, 0, 1, 4, 0, 3, 4, 2, 2, 3, 1, 0, 3, 3, 3, 3, 1, 3, 4, 4, 1, 0,\n",
      "        3, 1, 2, 1, 0, 4, 1, 2, 1, 1, 0, 4, 2, 3, 4, 3, 4, 4, 4, 4, 4, 0, 4, 1,\n",
      "        3, 4, 0, 0, 0, 2, 3, 2, 1, 4, 2, 2, 2, 4, 3, 1, 3, 0, 2, 3, 1, 0, 3, 2,\n",
      "        3, 0, 1, 1, 3, 2, 2, 1, 2, 3, 1, 0, 2, 3, 1, 2, 1, 2, 1, 4, 3, 2, 0, 4,\n",
      "        2, 2, 1, 0, 3, 3, 1, 1], device='cuda:0')\n",
      "相等的结果为： tensor([1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1,\n",
      "        1, 1, 0, 1, 1, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.9427083333333334\n",
      "============================================\n",
      "准确率由： 0.9352964743589743 上升至： 0.9447115384615384 已更新并保存权值为weights/best.pkl\n",
      "第22个epoch的识别准确率为：94%\n",
      "epoch:23,loss:0.1606\n",
      "============================================\n",
      "源数据标签： tensor([4, 1, 4, 1, 1, 3, 1, 2, 3, 4, 0, 2, 1, 0, 0, 4, 4, 1, 3, 3, 4, 1, 3, 4,\n",
      "        2, 0, 1, 1, 0, 2, 2, 1, 3, 0, 4, 4, 4, 4, 1, 0, 1, 4, 2, 4, 4, 4, 4, 4,\n",
      "        3, 0, 1, 3, 4, 4, 2, 4, 0, 2, 1, 3, 1, 3, 1, 0, 4, 1, 2, 2, 3, 3, 1, 2,\n",
      "        3, 3, 3, 4, 2, 3, 2, 2, 0, 0, 3, 2, 1, 3, 0, 4, 4, 1, 0, 0, 1, 3, 0, 1,\n",
      "        0, 3, 3, 3, 0, 3, 0, 3, 3, 1, 1, 2, 3, 1, 3, 0, 3, 1, 3, 4, 4, 1, 4, 0,\n",
      "        1, 4, 1, 4, 1, 2, 3, 2], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([4, 1, 4, 0, 1, 3, 1, 2, 3, 4, 0, 2, 1, 0, 0, 4, 4, 1, 3, 3, 4, 1, 3, 4,\n",
      "        2, 0, 1, 1, 0, 2, 2, 1, 3, 0, 2, 4, 4, 4, 1, 0, 1, 4, 2, 4, 4, 4, 4, 4,\n",
      "        3, 0, 1, 3, 4, 4, 2, 4, 0, 2, 1, 3, 1, 3, 1, 0, 4, 1, 2, 2, 3, 3, 1, 2,\n",
      "        3, 3, 3, 4, 2, 3, 2, 2, 0, 0, 3, 2, 1, 3, 0, 4, 4, 1, 0, 0, 1, 3, 0, 1,\n",
      "        0, 3, 3, 3, 0, 4, 0, 3, 1, 2, 1, 2, 3, 1, 3, 0, 3, 1, 3, 4, 4, 1, 4, 0,\n",
      "        1, 4, 1, 4, 1, 2, 3, 2], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.9481770833333333\n",
      "============================================\n",
      "准确率由： 0.9447115384615384 上升至： 0.9451121794871795 已更新并保存权值为weights/best.pkl\n",
      "第23个epoch的识别准确率为：94%\n",
      "epoch:24,loss:0.1271\n",
      "============================================\n",
      "源数据标签： tensor([1, 4, 3, 2, 4, 4, 0, 3, 4, 0, 2, 1, 4, 3, 3, 0, 2, 0, 3, 3, 2, 1, 2, 0,\n",
      "        1, 3, 1, 3, 2, 2, 1, 3, 0, 3, 3, 0, 2, 3, 1, 4, 3, 0, 1, 1, 3, 0, 2, 1,\n",
      "        1, 3, 4, 1, 1, 1, 3, 4, 2, 3, 4, 1, 1, 2, 0, 3, 3, 1, 3, 2, 1, 2, 3, 2,\n",
      "        3, 1, 4, 3, 1, 2, 1, 2, 4, 4, 4, 1, 1, 1, 1, 3, 1, 1, 1, 3, 2, 2, 0, 1,\n",
      "        0, 2, 2, 3, 1, 1, 0, 1, 1, 2, 1, 4, 0, 2, 4, 3, 2, 3, 2, 3, 3, 2, 3, 0,\n",
      "        4, 1, 2, 4, 1, 3, 3, 0], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([1, 4, 3, 2, 4, 4, 0, 3, 4, 0, 2, 1, 4, 3, 3, 0, 2, 0, 3, 1, 2, 1, 2, 0,\n",
      "        1, 3, 1, 3, 2, 2, 1, 1, 0, 3, 3, 0, 2, 3, 1, 1, 3, 0, 1, 1, 3, 0, 2, 1,\n",
      "        1, 3, 4, 1, 1, 1, 3, 4, 2, 3, 4, 2, 1, 2, 0, 3, 3, 3, 3, 2, 1, 2, 3, 2,\n",
      "        3, 1, 4, 3, 1, 2, 1, 2, 4, 4, 4, 1, 1, 1, 1, 3, 1, 1, 1, 3, 2, 2, 0, 1,\n",
      "        0, 2, 2, 3, 1, 3, 0, 1, 1, 4, 1, 4, 0, 2, 4, 3, 2, 3, 2, 3, 3, 2, 3, 0,\n",
      "        4, 1, 2, 4, 1, 3, 3, 0], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.9546875\n",
      "============================================\n",
      "准确率由： 0.9451121794871795 上升至： 0.9537259615384616 已更新并保存权值为weights/best.pkl\n",
      "第24个epoch的识别准确率为：95%\n",
      "epoch:25,loss:0.1807\n",
      "============================================\n",
      "源数据标签： tensor([1, 3, 3, 0, 0, 3, 0, 4, 1, 2, 3, 4, 0, 3, 4, 3, 1, 4, 3, 0, 3, 0, 3, 1,\n",
      "        1, 4, 2, 1, 1, 1, 3, 3, 1, 0, 4, 2, 2, 4, 0, 1, 1, 2, 1, 3, 4, 3, 3, 3,\n",
      "        4, 2, 2, 4, 2, 2, 0, 4, 3, 0, 3, 3, 4, 1, 1, 3, 2, 1, 0, 0, 2, 3, 2, 1,\n",
      "        4, 0, 0, 3, 1, 0, 0, 1, 3, 3, 4, 1, 1, 4, 0, 4, 0, 1, 1, 0, 0, 3, 3, 2,\n",
      "        1, 4, 3, 1, 3, 2, 0, 0, 1, 4, 1, 0, 1, 0, 2, 3, 1, 1, 2, 2, 0, 2, 2, 0,\n",
      "        2, 2, 4, 4, 2, 4, 1, 4], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([1, 1, 3, 0, 0, 3, 0, 4, 1, 2, 3, 4, 0, 3, 4, 3, 1, 4, 3, 0, 3, 0, 3, 1,\n",
      "        1, 4, 2, 1, 1, 1, 3, 3, 1, 0, 4, 2, 2, 2, 0, 1, 1, 2, 1, 3, 3, 3, 3, 1,\n",
      "        2, 2, 2, 4, 2, 2, 0, 4, 3, 0, 3, 3, 4, 1, 1, 3, 2, 1, 0, 0, 2, 3, 2, 1,\n",
      "        2, 0, 0, 4, 1, 4, 0, 1, 3, 3, 4, 1, 1, 4, 0, 4, 0, 1, 1, 0, 0, 3, 3, 2,\n",
      "        1, 4, 3, 1, 3, 2, 2, 0, 1, 4, 1, 0, 1, 0, 2, 3, 1, 1, 2, 2, 0, 2, 2, 0,\n",
      "        2, 2, 4, 4, 2, 4, 4, 4], device='cuda:0')\n",
      "相等的结果为： tensor([1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0,\n",
      "        0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 0, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.95234375\n",
      "============================================\n",
      "第25个epoch的识别准确率为：95%\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "epoch:26,loss:0.1338\n",
      "============================================\n",
      "源数据标签： tensor([3, 2, 2, 3, 3, 4, 2, 2, 4, 2, 0, 2, 2, 3, 0, 1, 0, 3, 3, 4, 1, 2, 0, 1,\n",
      "        2, 4, 1, 3, 0, 1, 1, 3, 1, 4, 2, 3, 2, 1, 1, 2, 0, 1, 3, 4, 1, 1, 1, 2,\n",
      "        2, 0, 3, 4, 4, 3, 0, 0, 0, 0, 4, 0, 4, 4, 0, 1, 2, 1, 0, 0, 0, 1, 1, 0,\n",
      "        3, 3, 2, 2, 2, 2, 0, 1, 3, 3, 1, 1, 1, 2, 2, 4, 0, 0, 3, 2, 0, 1, 3, 1,\n",
      "        4, 2, 0, 2, 0, 4, 4, 1, 0, 3, 1, 4, 0, 0, 4, 0, 2, 4, 1, 3, 0, 3, 2, 2,\n",
      "        1, 3, 0, 2, 1, 3, 2, 0], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([3, 2, 2, 3, 3, 4, 2, 2, 4, 2, 0, 2, 2, 3, 0, 1, 0, 3, 3, 4, 1, 2, 0, 1,\n",
      "        2, 4, 1, 3, 0, 1, 1, 3, 1, 4, 2, 3, 2, 1, 1, 2, 0, 1, 3, 4, 1, 1, 1, 2,\n",
      "        2, 0, 3, 4, 4, 3, 0, 0, 0, 0, 4, 0, 4, 4, 0, 1, 2, 1, 0, 0, 0, 4, 1, 0,\n",
      "        3, 3, 2, 2, 2, 1, 0, 1, 1, 3, 1, 1, 1, 2, 2, 4, 0, 0, 3, 2, 0, 1, 3, 1,\n",
      "        4, 2, 0, 2, 0, 4, 4, 1, 0, 3, 1, 4, 0, 0, 4, 0, 2, 4, 1, 3, 0, 3, 2, 2,\n",
      "        1, 3, 0, 2, 1, 2, 2, 0], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1,\n",
      "        1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 0, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.95625\n",
      "============================================\n",
      "准确率由： 0.9537259615384616 上升至： 0.9551282051282052 已更新并保存权值为weights/best.pkl\n",
      "第26个epoch的识别准确率为：95%\n",
      "epoch:27,loss:0.0507\n",
      "============================================\n",
      "源数据标签： tensor([4, 0, 4, 3, 1, 2, 4, 0, 2, 1, 1, 0, 3, 1, 1, 3, 4, 1, 2, 1, 3, 4, 3, 2,\n",
      "        0, 1, 0, 0, 1, 4, 1, 2, 1, 0, 3, 2, 3, 1, 3, 4, 3, 0, 3, 1, 4, 0, 0, 0,\n",
      "        0, 2, 0, 1, 2, 1, 1, 4, 4, 0, 4, 1, 3, 4, 2, 3, 4, 4, 0, 0, 3, 2, 3, 0,\n",
      "        3, 3, 2, 3, 3, 4, 3, 4, 3, 0, 0, 2, 2, 0, 3, 1, 3, 2, 1, 2, 3, 2, 0, 4,\n",
      "        4, 3, 2, 3, 0, 1, 1, 3, 4, 0, 1, 4, 0, 4, 2, 1, 4, 4, 2, 2, 2, 1, 4, 4,\n",
      "        3, 1, 2, 1, 1, 4, 1, 3], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([4, 0, 4, 3, 1, 2, 4, 0, 2, 1, 1, 0, 3, 1, 1, 3, 4, 1, 2, 1, 3, 4, 3, 2,\n",
      "        0, 1, 0, 0, 1, 4, 1, 2, 1, 0, 3, 2, 3, 1, 3, 4, 3, 0, 3, 1, 4, 0, 0, 0,\n",
      "        0, 2, 0, 1, 2, 1, 1, 4, 4, 0, 4, 1, 3, 4, 2, 3, 4, 4, 0, 0, 3, 2, 3, 0,\n",
      "        3, 3, 2, 3, 3, 4, 3, 4, 3, 0, 0, 2, 2, 0, 3, 1, 3, 2, 1, 4, 3, 2, 0, 4,\n",
      "        4, 3, 2, 3, 0, 1, 1, 3, 4, 0, 1, 4, 0, 4, 2, 1, 4, 4, 1, 2, 2, 1, 4, 4,\n",
      "        3, 1, 2, 1, 1, 4, 1, 3], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.9598958333333333\n",
      "============================================\n",
      "准确率由： 0.9551282051282052 上升至： 0.9591346153846154 已更新并保存权值为weights/best.pkl\n",
      "第27个epoch的识别准确率为：95%\n",
      "epoch:28,loss:0.1228\n",
      "============================================\n",
      "源数据标签： tensor([3, 3, 3, 1, 1, 2, 2, 2, 2, 0, 3, 1, 0, 2, 1, 0, 1, 1, 2, 0, 2, 1, 3, 4,\n",
      "        1, 4, 3, 4, 2, 1, 3, 1, 0, 2, 1, 1, 4, 1, 3, 3, 1, 1, 1, 1, 3, 1, 3, 0,\n",
      "        1, 2, 3, 1, 4, 3, 0, 3, 3, 4, 2, 1, 2, 3, 3, 4, 2, 0, 1, 4, 4, 0, 4, 3,\n",
      "        1, 2, 0, 4, 4, 0, 0, 3, 2, 4, 3, 3, 2, 1, 0, 4, 1, 1, 4, 0, 1, 1, 4, 1,\n",
      "        2, 3, 1, 3, 1, 0, 3, 1, 3, 3, 2, 2, 3, 4, 0, 1, 3, 2, 2, 2, 1, 0, 1, 4,\n",
      "        3, 4, 0, 3, 1, 2, 0, 3], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([3, 3, 3, 1, 1, 2, 2, 2, 2, 0, 3, 1, 0, 2, 1, 0, 1, 1, 2, 0, 2, 1, 3, 4,\n",
      "        1, 4, 3, 4, 2, 1, 3, 1, 0, 2, 1, 1, 4, 1, 3, 3, 1, 1, 1, 4, 3, 1, 3, 0,\n",
      "        1, 2, 3, 1, 4, 3, 0, 3, 3, 4, 2, 1, 2, 3, 3, 4, 2, 0, 1, 4, 4, 0, 4, 3,\n",
      "        1, 2, 0, 4, 4, 0, 0, 3, 2, 4, 3, 3, 2, 1, 0, 4, 1, 1, 4, 0, 1, 1, 4, 1,\n",
      "        2, 3, 1, 3, 1, 0, 3, 1, 3, 3, 2, 2, 3, 4, 0, 1, 3, 2, 2, 2, 1, 0, 1, 4,\n",
      "        3, 4, 0, 4, 1, 2, 0, 3], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 0, 1, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.9510416666666667\n",
      "============================================\n",
      "第28个epoch的识别准确率为：95%\n",
      "epoch:29,loss:0.0927\n",
      "============================================\n",
      "源数据标签： tensor([1, 2, 0, 3, 1, 1, 0, 1, 1, 1, 1, 2, 4, 0, 1, 1, 4, 0, 4, 3, 3, 2, 1, 2,\n",
      "        4, 0, 1, 4, 1, 1, 1, 4, 0, 2, 3, 4, 1, 2, 2, 4, 2, 0, 3, 4, 0, 1, 1, 1,\n",
      "        2, 3, 0, 1, 4, 1, 1, 1, 2, 3, 2, 3, 4, 3, 3, 3, 2, 0, 0, 3, 4, 4, 1, 4,\n",
      "        1, 0, 0, 4, 1, 4, 2, 1, 3, 3, 4, 1, 4, 1, 1, 3, 3, 4, 0, 2, 4, 2, 4, 0,\n",
      "        3, 2, 3, 0, 2, 2, 2, 2, 2, 1, 1, 2, 4, 0, 3, 0, 1, 0, 3, 0, 4, 0, 0, 4,\n",
      "        1, 1, 0, 2, 4, 4, 1, 2], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([1, 2, 0, 3, 1, 1, 0, 1, 1, 1, 1, 2, 4, 0, 1, 1, 4, 0, 4, 3, 3, 2, 1, 2,\n",
      "        4, 0, 1, 4, 1, 1, 1, 4, 0, 2, 3, 4, 1, 2, 2, 4, 2, 0, 2, 4, 0, 1, 1, 1,\n",
      "        2, 3, 0, 1, 4, 1, 1, 1, 2, 3, 2, 3, 4, 3, 3, 3, 2, 0, 0, 3, 4, 3, 1, 4,\n",
      "        1, 0, 0, 4, 1, 4, 2, 1, 3, 3, 4, 1, 4, 1, 1, 3, 3, 3, 0, 2, 4, 2, 4, 0,\n",
      "        3, 2, 3, 0, 2, 2, 2, 2, 2, 1, 1, 2, 3, 0, 3, 0, 1, 0, 3, 0, 4, 0, 0, 4,\n",
      "        1, 1, 0, 2, 4, 4, 1, 2], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.9625\n",
      "============================================\n",
      "准确率由： 0.9591346153846154 上升至： 0.960136217948718 已更新并保存权值为weights/best.pkl\n",
      "第29个epoch的识别准确率为：96%\n",
      "epoch:30,loss:0.1157\n",
      "============================================\n",
      "源数据标签： tensor([4, 0, 3, 3, 0, 2, 1, 3, 4, 3, 0, 1, 4, 1, 0, 1, 3, 4, 3, 1, 0, 0, 0, 2,\n",
      "        3, 2, 0, 0, 3, 2, 3, 3, 3, 2, 2, 4, 0, 4, 0, 2, 3, 4, 0, 0, 2, 2, 4, 2,\n",
      "        2, 0, 1, 3, 3, 2, 4, 4, 1, 3, 4, 2, 3, 3, 4, 4, 0, 3, 1, 3, 0, 0, 1, 3,\n",
      "        2, 2, 0, 3, 4, 4, 1, 2, 4, 2, 3, 3, 1, 2, 3, 3, 1, 1, 1, 1, 3, 3, 1, 2,\n",
      "        0, 2, 0, 2, 4, 2, 2, 1, 1, 3, 0, 0, 0, 1, 0, 0, 2, 1, 2, 0, 3, 1, 3, 2,\n",
      "        2, 2, 3, 3, 0, 3, 3, 2], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([4, 0, 3, 3, 0, 2, 1, 4, 4, 3, 0, 1, 4, 1, 0, 1, 3, 4, 3, 1, 0, 0, 0, 2,\n",
      "        3, 2, 0, 0, 3, 2, 3, 3, 3, 2, 2, 4, 0, 4, 0, 2, 3, 4, 0, 0, 2, 2, 1, 2,\n",
      "        2, 0, 1, 3, 3, 2, 4, 4, 1, 3, 4, 2, 3, 3, 4, 4, 0, 3, 1, 3, 0, 0, 1, 3,\n",
      "        2, 2, 0, 4, 4, 4, 1, 4, 4, 2, 3, 3, 1, 2, 3, 3, 1, 1, 1, 1, 3, 3, 1, 2,\n",
      "        0, 2, 0, 2, 4, 2, 2, 1, 1, 3, 0, 0, 0, 1, 0, 0, 2, 1, 2, 2, 3, 1, 3, 2,\n",
      "        2, 2, 3, 3, 2, 3, 3, 2], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 0, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.9609375\n",
      "============================================\n",
      "第30个epoch的识别准确率为：95%\n",
      "epoch:31,loss:0.5558\n",
      "============================================\n",
      "源数据标签： tensor([3, 3, 4, 2, 1, 4, 3, 0, 1, 3, 2, 4, 1, 2, 0, 4, 2, 4, 1, 4, 3, 3, 3, 0,\n",
      "        2, 2, 0, 2, 1, 0, 2, 0, 3, 1, 4, 4, 3, 3, 1, 3, 4, 4, 0, 1, 2, 2, 3, 0,\n",
      "        2, 4, 1, 1, 0, 2, 2, 0, 1, 4, 3, 4, 2, 4, 0, 2, 0, 0, 1, 1, 1, 3, 0, 2,\n",
      "        1, 2, 0, 0, 2, 0, 1, 0, 2, 1, 4, 3, 1, 0, 2, 2, 2, 3, 0, 2, 4, 1, 3, 3,\n",
      "        2, 1, 3, 3, 2, 3, 3, 0, 3, 4, 3, 3, 1, 4, 2, 1, 3, 0, 1, 0, 4, 3, 4, 3,\n",
      "        1, 2, 0, 3, 4, 2, 2, 4], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([4, 3, 3, 2, 1, 4, 4, 0, 1, 4, 2, 3, 1, 2, 0, 4, 1, 1, 1, 4, 3, 3, 3, 0,\n",
      "        1, 4, 0, 2, 1, 0, 2, 0, 3, 1, 3, 4, 1, 3, 1, 1, 1, 4, 0, 2, 2, 2, 3, 0,\n",
      "        2, 4, 1, 1, 0, 2, 2, 0, 1, 4, 3, 4, 2, 3, 0, 2, 0, 0, 1, 1, 1, 3, 0, 2,\n",
      "        1, 2, 0, 0, 2, 0, 1, 0, 0, 1, 4, 3, 1, 0, 2, 2, 1, 3, 0, 2, 4, 2, 3, 3,\n",
      "        2, 1, 3, 3, 2, 2, 3, 0, 2, 4, 3, 3, 1, 4, 2, 1, 1, 0, 4, 0, 3, 3, 4, 3,\n",
      "        1, 2, 0, 2, 4, 4, 2, 4], device='cuda:0')\n",
      "相等的结果为： tensor([0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1,\n",
      "        0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1,\n",
      "        1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1,\n",
      "        1, 1, 1, 0, 1, 0, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.9609375\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "============================================\n",
      "准确率由： 0.960136217948718 上升至： 0.9619391025641025 已更新并保存权值为weights/best.pkl\n",
      "第31个epoch的识别准确率为：96%\n",
      "epoch:32,loss:0.1477\n",
      "============================================\n",
      "源数据标签： tensor([3, 1, 1, 1, 3, 3, 1, 0, 1, 2, 4, 0, 1, 1, 1, 4, 1, 2, 2, 0, 1, 1, 1, 4,\n",
      "        4, 1, 1, 1, 0, 1, 1, 0, 4, 1, 4, 1, 0, 0, 1, 2, 3, 3, 3, 2, 1, 3, 4, 3,\n",
      "        0, 1, 1, 3, 1, 3, 0, 0, 3, 4, 1, 1, 2, 1, 2, 3, 3, 1, 2, 2, 2, 3, 3, 2,\n",
      "        3, 3, 1, 3, 3, 0, 3, 1, 1, 1, 4, 1, 1, 0, 0, 1, 3, 4, 1, 0, 3, 4, 1, 4,\n",
      "        0, 0, 4, 1, 0, 1, 2, 3, 4, 0, 4, 2, 1, 0, 0, 4, 3, 1, 1, 0, 1, 0, 1, 3,\n",
      "        4, 3, 4, 0, 3, 0, 1, 2], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([3, 1, 1, 1, 3, 3, 4, 0, 1, 2, 4, 0, 1, 1, 1, 4, 1, 2, 2, 0, 1, 1, 1, 4,\n",
      "        4, 1, 1, 1, 0, 1, 1, 0, 4, 1, 4, 1, 0, 0, 1, 2, 3, 3, 3, 2, 1, 3, 4, 3,\n",
      "        0, 1, 1, 3, 1, 3, 0, 0, 3, 4, 1, 1, 2, 1, 2, 3, 3, 1, 2, 2, 2, 3, 3, 2,\n",
      "        3, 3, 3, 3, 1, 0, 3, 1, 1, 2, 4, 1, 1, 0, 0, 3, 3, 4, 1, 0, 3, 4, 1, 4,\n",
      "        0, 0, 4, 1, 0, 1, 2, 3, 4, 0, 4, 2, 1, 0, 0, 4, 3, 1, 1, 0, 1, 0, 1, 3,\n",
      "        4, 3, 4, 0, 3, 0, 2, 3], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 0, 0], device='cuda:0', dtype=torch.uint8)\n",
      "0.9619791666666667\n",
      "============================================\n",
      "准确率由： 0.9619391025641025 上升至： 0.9627403846153846 已更新并保存权值为weights/best.pkl\n",
      "第32个epoch的识别准确率为：96%\n",
      "epoch:33,loss:0.1695\n",
      "============================================\n",
      "源数据标签： tensor([1, 3, 4, 3, 3, 2, 4, 0, 0, 0, 4, 2, 2, 2, 0, 1, 2, 3, 3, 2, 2, 0, 2, 1,\n",
      "        1, 1, 1, 3, 2, 1, 1, 1, 2, 3, 1, 0, 3, 3, 0, 3, 1, 3, 0, 1, 1, 2, 2, 4,\n",
      "        3, 4, 2, 1, 2, 0, 1, 0, 4, 3, 3, 0, 2, 4, 3, 3, 2, 1, 1, 4, 3, 2, 3, 3,\n",
      "        1, 0, 1, 3, 1, 3, 1, 3, 1, 2, 3, 2, 3, 4, 4, 0, 1, 3, 4, 4, 0, 2, 0, 2,\n",
      "        0, 4, 3, 3, 2, 0, 1, 3, 1, 2, 2, 0, 3, 0, 4, 0, 0, 1, 2, 1, 3, 1, 2, 3,\n",
      "        0, 1, 2, 2, 3, 4, 3, 1], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([1, 3, 4, 3, 3, 2, 4, 0, 0, 0, 3, 2, 2, 2, 0, 1, 2, 3, 1, 2, 2, 0, 2, 1,\n",
      "        1, 1, 1, 3, 2, 1, 1, 1, 2, 3, 4, 0, 3, 3, 0, 3, 1, 3, 0, 1, 1, 2, 2, 1,\n",
      "        3, 4, 2, 1, 4, 0, 1, 0, 4, 3, 2, 0, 2, 4, 3, 3, 2, 1, 1, 4, 3, 2, 4, 3,\n",
      "        1, 0, 1, 3, 1, 3, 1, 3, 1, 2, 3, 2, 3, 4, 4, 0, 1, 3, 4, 4, 0, 2, 0, 2,\n",
      "        0, 4, 2, 3, 2, 0, 1, 3, 1, 2, 2, 0, 3, 0, 4, 0, 0, 1, 2, 1, 3, 1, 2, 3,\n",
      "        0, 1, 2, 4, 3, 4, 3, 1], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,\n",
      "        1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 0, 1, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.9606770833333333\n",
      "============================================\n",
      "第33个epoch的识别准确率为：96%\n",
      "epoch:34,loss:0.0209\n",
      "============================================\n",
      "源数据标签： tensor([1, 2, 3, 3, 0, 0, 3, 3, 3, 3, 0, 2, 1, 1, 2, 2, 4, 3, 0, 3, 1, 4, 1, 0,\n",
      "        4, 3, 0, 4, 1, 3, 0, 0, 1, 2, 2, 4, 2, 1, 2, 2, 2, 3, 2, 3, 1, 2, 0, 1,\n",
      "        4, 3, 1, 2, 3, 0, 4, 1, 1, 3, 2, 1, 0, 2, 3, 4, 1, 3, 4, 4, 1, 3, 0, 0,\n",
      "        0, 4, 0, 1, 2, 4, 4, 4, 3, 2, 3, 4, 4, 1, 2, 2, 3, 1, 3, 1, 1, 3, 3, 3,\n",
      "        4, 2, 1, 3, 0, 4, 3, 4, 2, 0, 4, 0, 2, 2, 1, 3, 4, 2, 0, 4, 2, 1, 1, 1,\n",
      "        1, 2, 4, 3, 1, 3, 3, 2], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([1, 2, 3, 3, 0, 0, 3, 3, 3, 3, 0, 2, 1, 1, 2, 2, 4, 3, 0, 3, 1, 4, 1, 0,\n",
      "        4, 3, 0, 4, 1, 3, 0, 0, 1, 2, 2, 4, 2, 1, 2, 2, 2, 3, 2, 3, 1, 2, 0, 1,\n",
      "        4, 3, 1, 2, 3, 0, 4, 1, 1, 3, 2, 1, 0, 2, 3, 4, 1, 3, 4, 4, 1, 3, 0, 0,\n",
      "        0, 4, 0, 1, 2, 4, 4, 4, 3, 2, 3, 4, 4, 1, 2, 2, 3, 1, 3, 1, 1, 3, 3, 3,\n",
      "        4, 2, 1, 3, 0, 4, 3, 4, 2, 0, 4, 0, 2, 2, 1, 3, 4, 2, 0, 4, 2, 1, 1, 1,\n",
      "        1, 2, 4, 3, 1, 3, 3, 2], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.9661458333333334\n",
      "============================================\n",
      "准确率由： 0.9627403846153846 上升至： 0.9675480769230769 已更新并保存权值为weights/best.pkl\n",
      "第34个epoch的识别准确率为：96%\n",
      "epoch:35,loss:0.1326\n",
      "============================================\n",
      "源数据标签： tensor([0, 2, 2, 2, 2, 4, 0, 4, 3, 0, 3, 1, 1, 2, 2, 1, 2, 0, 3, 3, 3, 1, 3, 4,\n",
      "        3, 1, 4, 0, 3, 2, 4, 2, 1, 4, 3, 1, 0, 4, 0, 0, 1, 3, 4, 3, 4, 0, 3, 2,\n",
      "        4, 0, 3, 3, 1, 4, 0, 3, 0, 1, 0, 4, 4, 1, 2, 4, 3, 3, 0, 2, 3, 0, 3, 1,\n",
      "        3, 2, 1, 3, 1, 1, 1, 4, 2, 3, 0, 1, 3, 4, 0, 3, 2, 2, 2, 0, 4, 0, 3, 0,\n",
      "        1, 2, 0, 4, 1, 1, 2, 3, 0, 0, 4, 0, 4, 2, 2, 3, 4, 0, 1, 3, 4, 1, 3, 1,\n",
      "        3, 3, 1, 2, 1, 1, 1, 1], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([0, 2, 2, 2, 2, 4, 0, 4, 3, 0, 3, 1, 1, 2, 2, 1, 2, 0, 3, 3, 3, 1, 3, 4,\n",
      "        3, 1, 3, 0, 3, 2, 4, 2, 2, 4, 3, 1, 0, 4, 0, 0, 1, 3, 4, 3, 4, 0, 3, 2,\n",
      "        4, 0, 3, 1, 1, 4, 0, 3, 0, 1, 0, 4, 4, 1, 2, 1, 3, 3, 0, 2, 3, 0, 3, 1,\n",
      "        3, 2, 1, 3, 1, 1, 1, 4, 2, 3, 0, 1, 3, 4, 0, 3, 2, 2, 2, 0, 4, 0, 3, 0,\n",
      "        1, 2, 0, 4, 1, 1, 2, 3, 0, 0, 4, 0, 4, 2, 2, 3, 4, 0, 1, 3, 4, 1, 3, 1,\n",
      "        3, 3, 1, 2, 1, 1, 1, 1], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.9713541666666666\n",
      "============================================\n",
      "准确率由： 0.9675480769230769 上升至： 0.9685496794871795 已更新并保存权值为weights/best.pkl\n",
      "第35个epoch的识别准确率为：96%\n",
      "epoch:36,loss:0.1728\n",
      "============================================\n",
      "源数据标签： tensor([2, 2, 3, 1, 4, 0, 1, 4, 1, 2, 1, 4, 0, 1, 0, 4, 2, 2, 1, 2, 2, 1, 1, 3,\n",
      "        1, 0, 1, 2, 2, 3, 3, 0, 0, 1, 2, 4, 1, 3, 1, 1, 1, 2, 3, 4, 1, 0, 1, 4,\n",
      "        2, 3, 3, 0, 3, 3, 0, 1, 0, 3, 2, 0, 3, 4, 0, 0, 0, 2, 0, 0, 4, 3, 4, 3,\n",
      "        3, 2, 3, 1, 2, 4, 2, 3, 3, 3, 2, 3, 4, 2, 0, 3, 0, 3, 1, 0, 3, 1, 4, 3,\n",
      "        2, 4, 4, 4, 2, 3, 2, 1, 4, 3, 1, 4, 2, 3, 3, 1, 4, 4, 2, 1, 1, 3, 1, 3,\n",
      "        3, 2, 0, 0, 3, 3, 3, 4], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([2, 2, 3, 1, 4, 0, 1, 4, 1, 2, 1, 4, 0, 1, 0, 4, 2, 2, 1, 2, 2, 1, 1, 3,\n",
      "        1, 0, 1, 2, 2, 3, 3, 0, 0, 1, 2, 4, 1, 3, 1, 1, 3, 2, 2, 4, 1, 0, 1, 4,\n",
      "        2, 2, 3, 0, 3, 2, 0, 1, 0, 3, 2, 0, 4, 4, 0, 0, 0, 2, 0, 0, 4, 3, 4, 3,\n",
      "        3, 2, 3, 1, 2, 4, 2, 4, 3, 3, 2, 3, 4, 2, 0, 3, 0, 3, 1, 0, 3, 1, 1, 3,\n",
      "        2, 4, 4, 4, 2, 3, 2, 1, 4, 4, 1, 4, 2, 3, 1, 1, 4, 4, 2, 1, 1, 3, 1, 3,\n",
      "        3, 2, 0, 0, 3, 3, 3, 4], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1,\n",
      "        1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.9736979166666667\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "============================================\n",
      "准确率由： 0.9685496794871795 上升至： 0.9713541666666666 已更新并保存权值为weights/best.pkl\n",
      "第36个epoch的识别准确率为：97%\n",
      "epoch:37,loss:0.1005\n",
      "============================================\n",
      "源数据标签： tensor([2, 1, 2, 0, 0, 1, 3, 3, 4, 1, 2, 0, 4, 3, 0, 1, 2, 2, 0, 4, 2, 0, 1, 2,\n",
      "        0, 2, 0, 3, 1, 2, 0, 0, 1, 2, 2, 2, 4, 3, 3, 0, 1, 0, 0, 4, 0, 1, 3, 4,\n",
      "        4, 2, 3, 4, 3, 3, 0, 4, 1, 3, 4, 0, 0, 3, 2, 3, 4, 0, 0, 2, 3, 1, 1, 2,\n",
      "        1, 4, 4, 1, 0, 3, 0, 1, 1, 2, 1, 2, 0, 3, 3, 4, 3, 3, 1, 0, 3, 4, 4, 0,\n",
      "        2, 4, 2, 0, 0, 0, 2, 1, 2, 2, 2, 4, 1, 1, 1, 0, 0, 1, 1, 1, 4, 2, 0, 0,\n",
      "        2, 2, 3, 3, 4, 4, 1, 0], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([2, 1, 2, 0, 0, 1, 3, 3, 4, 1, 2, 0, 4, 3, 0, 1, 2, 2, 0, 4, 4, 1, 1, 2,\n",
      "        0, 2, 0, 3, 1, 2, 0, 0, 1, 2, 2, 2, 4, 3, 3, 0, 1, 0, 0, 4, 0, 1, 3, 4,\n",
      "        4, 2, 3, 4, 3, 3, 0, 4, 1, 1, 4, 0, 0, 3, 2, 3, 4, 0, 0, 2, 3, 1, 1, 2,\n",
      "        1, 4, 4, 1, 0, 3, 0, 1, 1, 2, 1, 4, 0, 3, 3, 4, 3, 3, 1, 0, 3, 4, 4, 0,\n",
      "        2, 4, 2, 0, 0, 0, 2, 1, 2, 2, 2, 4, 1, 1, 1, 0, 0, 1, 1, 1, 4, 2, 0, 0,\n",
      "        2, 2, 3, 3, 4, 4, 1, 0], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.9747395833333333\n",
      "============================================\n",
      "第37个epoch的识别准确率为：97%\n",
      "epoch:38,loss:0.1150\n",
      "============================================\n",
      "源数据标签： tensor([3, 1, 3, 4, 0, 3, 2, 0, 4, 2, 4, 4, 4, 3, 2, 4, 1, 3, 4, 3, 1, 4, 1, 1,\n",
      "        0, 1, 3, 2, 2, 2, 1, 2, 3, 0, 3, 4, 4, 3, 0, 4, 1, 2, 1, 1, 3, 2, 3, 0,\n",
      "        2, 1, 3, 0, 1, 1, 4, 3, 0, 1, 1, 1, 1, 4, 0, 0, 2, 2, 0, 2, 4, 0, 1, 4,\n",
      "        4, 1, 3, 3, 1, 0, 4, 0, 2, 2, 4, 2, 0, 0, 1, 3, 1, 4, 2, 2, 0, 1, 1, 4,\n",
      "        3, 0, 3, 3, 0, 3, 2, 4, 0, 0, 1, 1, 1, 1, 4, 1, 2, 1, 1, 1, 2, 2, 3, 1,\n",
      "        3, 2, 2, 0, 4, 3, 4, 4], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([3, 1, 3, 4, 0, 3, 2, 0, 4, 2, 3, 4, 3, 3, 2, 4, 1, 3, 4, 3, 1, 4, 1, 1,\n",
      "        0, 1, 3, 2, 2, 2, 1, 2, 3, 0, 2, 4, 4, 3, 0, 4, 1, 2, 1, 1, 3, 2, 3, 0,\n",
      "        2, 1, 3, 0, 1, 1, 4, 3, 0, 1, 1, 1, 1, 4, 0, 0, 2, 2, 0, 2, 4, 0, 1, 4,\n",
      "        4, 1, 3, 3, 1, 0, 4, 0, 2, 2, 4, 2, 0, 0, 1, 3, 1, 4, 2, 1, 0, 1, 1, 4,\n",
      "        3, 0, 3, 4, 0, 3, 2, 4, 0, 0, 1, 1, 1, 1, 4, 1, 2, 1, 1, 1, 2, 2, 3, 1,\n",
      "        3, 2, 2, 0, 4, 3, 4, 4], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1,\n",
      "        1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.95859375\n",
      "============================================\n",
      "第38个epoch的识别准确率为：96%\n",
      "epoch:39,loss:0.0781\n",
      "============================================\n",
      "源数据标签： tensor([4, 1, 0, 2, 2, 2, 2, 1, 3, 1, 0, 0, 2, 2, 4, 2, 4, 3, 4, 4, 0, 2, 0, 0,\n",
      "        3, 1, 4, 1, 4, 0, 3, 3, 4, 1, 3, 4, 4, 1, 1, 3, 2, 2, 3, 1, 4, 4, 1, 0,\n",
      "        3, 2, 3, 1, 3, 1, 4, 1, 3, 2, 0, 2, 0, 3, 4, 1, 3, 3, 3, 0, 2, 4, 2, 3,\n",
      "        1, 0, 4, 3, 1, 1, 1, 1, 3, 4, 2, 0, 1, 1, 4, 0, 0, 2, 4, 0, 1, 0, 4, 4,\n",
      "        0, 2, 4, 4, 2, 3, 2, 2, 3, 4, 4, 0, 1, 3, 1, 1, 4, 4, 3, 1, 2, 3, 0, 2,\n",
      "        3, 4, 1, 4, 3, 1, 1, 3], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([4, 1, 0, 2, 1, 2, 2, 1, 3, 1, 0, 0, 2, 2, 4, 2, 4, 3, 4, 4, 0, 2, 0, 0,\n",
      "        3, 1, 4, 1, 4, 0, 3, 3, 4, 1, 3, 4, 4, 1, 1, 3, 2, 2, 3, 1, 4, 4, 1, 0,\n",
      "        3, 2, 3, 1, 3, 1, 4, 1, 3, 2, 0, 2, 0, 3, 4, 1, 3, 3, 3, 0, 2, 4, 2, 3,\n",
      "        1, 0, 4, 3, 1, 1, 1, 1, 3, 4, 2, 0, 1, 1, 4, 0, 0, 2, 4, 0, 1, 0, 4, 4,\n",
      "        0, 2, 4, 4, 2, 3, 2, 2, 3, 4, 4, 0, 1, 3, 1, 1, 1, 4, 3, 1, 2, 2, 0, 2,\n",
      "        3, 4, 1, 4, 3, 1, 1, 3], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.9723958333333333\n",
      "============================================\n",
      "第39个epoch的识别准确率为：97%\n",
      "epoch:40,loss:0.0506\n",
      "============================================\n",
      "源数据标签： tensor([2, 4, 0, 1, 4, 2, 0, 2, 2, 4, 1, 0, 3, 2, 0, 2, 3, 4, 2, 3, 4, 4, 2, 0,\n",
      "        1, 1, 1, 0, 0, 4, 2, 0, 1, 2, 4, 1, 1, 2, 2, 2, 2, 0, 4, 3, 0, 1, 1, 3,\n",
      "        1, 1, 4, 4, 4, 0, 0, 2, 1, 1, 3, 4, 3, 1, 2, 0, 0, 2, 0, 3, 3, 0, 4, 3,\n",
      "        3, 2, 2, 2, 4, 1, 3, 1, 3, 2, 4, 3, 1, 4, 2, 2, 3, 4, 2, 1, 2, 0, 1, 4,\n",
      "        3, 0, 3, 1, 1, 3, 3, 4, 2, 1, 1, 3, 1, 4, 0, 2, 2, 2, 4, 2, 3, 2, 0, 4,\n",
      "        1, 4, 1, 2, 4, 4, 2, 3], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([2, 4, 0, 1, 4, 2, 0, 2, 2, 4, 1, 0, 3, 2, 0, 2, 3, 4, 2, 3, 4, 4, 2, 0,\n",
      "        1, 1, 1, 0, 0, 4, 2, 0, 1, 2, 4, 1, 1, 2, 2, 2, 2, 0, 4, 3, 0, 1, 1, 3,\n",
      "        1, 1, 4, 4, 4, 0, 0, 2, 1, 1, 3, 4, 3, 1, 2, 0, 0, 2, 0, 3, 3, 0, 4, 3,\n",
      "        3, 2, 2, 2, 4, 1, 3, 1, 3, 2, 4, 3, 1, 3, 2, 2, 3, 4, 2, 1, 2, 0, 1, 4,\n",
      "        3, 0, 3, 1, 1, 3, 3, 4, 2, 1, 1, 3, 1, 4, 0, 2, 2, 2, 4, 2, 3, 2, 0, 4,\n",
      "        1, 4, 1, 2, 4, 4, 2, 3], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.9817708333333334\n",
      "============================================\n",
      "准确率由： 0.9713541666666666 上升至： 0.9793669871794872 已更新并保存权值为weights/best.pkl\n",
      "第40个epoch的识别准确率为：97%\n",
      "epoch:41,loss:0.0864\n",
      "============================================\n",
      "源数据标签： tensor([3, 1, 4, 2, 4, 3, 4, 0, 4, 4, 3, 1, 0, 2, 1, 3, 2, 4, 4, 3, 0, 4, 1, 1,\n",
      "        0, 3, 3, 1, 1, 2, 2, 3, 4, 3, 1, 4, 3, 4, 4, 0, 0, 1, 1, 4, 2, 1, 0, 1,\n",
      "        3, 1, 3, 3, 2, 4, 4, 4, 4, 0, 0, 4, 4, 3, 0, 4, 3, 0, 4, 0, 1, 0, 3, 4,\n",
      "        0, 0, 4, 1, 3, 4, 3, 3, 4, 1, 2, 1, 1, 2, 0, 2, 4, 1, 4, 4, 4, 2, 0, 0,\n",
      "        2, 0, 3, 4, 1, 0, 4, 3, 4, 1, 4, 1, 1, 0, 2, 2, 4, 2, 0, 0, 0, 4, 4, 4,\n",
      "        3, 4, 4, 3, 0, 2, 0, 2], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([3, 1, 4, 2, 4, 3, 4, 0, 4, 4, 3, 1, 0, 2, 1, 3, 2, 4, 4, 3, 0, 4, 1, 1,\n",
      "        0, 3, 3, 1, 1, 2, 2, 3, 4, 3, 1, 4, 3, 4, 4, 0, 0, 1, 1, 4, 2, 1, 0, 1,\n",
      "        3, 1, 3, 3, 2, 4, 4, 4, 4, 0, 0, 4, 4, 3, 0, 4, 3, 0, 4, 0, 1, 0, 3, 4,\n",
      "        0, 0, 4, 1, 3, 4, 3, 3, 4, 1, 2, 1, 1, 3, 0, 2, 4, 1, 4, 4, 4, 2, 0, 0,\n",
      "        2, 0, 3, 4, 1, 0, 1, 3, 4, 1, 4, 1, 1, 0, 2, 2, 4, 2, 0, 0, 0, 4, 4, 4,\n",
      "        3, 4, 4, 3, 0, 2, 0, 2], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.9822916666666667\n",
      "============================================\n",
      "准确率由： 0.9793669871794872 上升至： 0.9805689102564102 已更新并保存权值为weights/best.pkl\n",
      "第41个epoch的识别准确率为：98%\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "epoch:42,loss:0.0565\n",
      "============================================\n",
      "源数据标签： tensor([2, 0, 3, 3, 2, 1, 4, 1, 4, 1, 3, 4, 4, 4, 4, 3, 0, 4, 4, 3, 2, 1, 4, 1,\n",
      "        3, 1, 4, 2, 0, 3, 0, 1, 1, 0, 3, 4, 4, 4, 1, 1, 0, 2, 2, 3, 2, 2, 0, 0,\n",
      "        1, 0, 1, 4, 1, 1, 0, 2, 3, 4, 3, 2, 1, 4, 1, 4, 2, 3, 1, 1, 3, 4, 1, 2,\n",
      "        1, 0, 4, 3, 0, 3, 1, 2, 1, 3, 1, 1, 4, 1, 1, 4, 1, 0, 2, 2, 0, 0, 0, 0,\n",
      "        0, 0, 3, 0, 2, 1, 3, 0, 2, 0, 3, 3, 2, 0, 1, 0, 1, 3, 1, 4, 2, 3, 3, 2,\n",
      "        3, 0, 2, 3, 0, 0, 3, 3], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([2, 0, 3, 3, 2, 1, 4, 1, 4, 1, 3, 4, 4, 4, 4, 3, 0, 4, 4, 3, 2, 1, 4, 1,\n",
      "        3, 1, 4, 2, 0, 3, 0, 1, 1, 0, 3, 4, 4, 4, 1, 1, 0, 2, 2, 3, 2, 2, 0, 0,\n",
      "        1, 0, 3, 4, 1, 1, 0, 2, 3, 4, 3, 2, 1, 4, 1, 4, 2, 3, 1, 1, 3, 4, 1, 2,\n",
      "        1, 0, 4, 3, 0, 3, 1, 2, 1, 3, 1, 1, 4, 1, 1, 4, 1, 0, 2, 2, 0, 0, 0, 0,\n",
      "        0, 0, 3, 0, 2, 1, 3, 0, 2, 0, 3, 3, 2, 0, 1, 0, 1, 3, 4, 4, 2, 3, 3, 2,\n",
      "        3, 0, 2, 3, 0, 0, 3, 4], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 0], device='cuda:0', dtype=torch.uint8)\n",
      "0.97890625\n",
      "============================================\n",
      "第42个epoch的识别准确率为：97%\n",
      "epoch:43,loss:0.0659\n",
      "============================================\n",
      "源数据标签： tensor([1, 4, 2, 0, 4, 2, 3, 2, 2, 1, 2, 2, 1, 2, 1, 1, 3, 3, 4, 4, 3, 3, 1, 3,\n",
      "        2, 1, 0, 1, 4, 2, 2, 4, 2, 3, 3, 3, 4, 3, 4, 3, 1, 1, 0, 3, 1, 1, 2, 4,\n",
      "        1, 3, 3, 1, 3, 4, 0, 4, 1, 1, 0, 4, 4, 4, 3, 4, 1, 2, 2, 3, 4, 2, 0, 2,\n",
      "        3, 1, 2, 4, 0, 3, 2, 1, 2, 1, 3, 0, 4, 4, 4, 3, 2, 0, 2, 2, 4, 2, 1, 2,\n",
      "        4, 3, 3, 2, 1, 3, 2, 4, 1, 1, 2, 0, 4, 3, 3, 1, 2, 0, 2, 4, 1, 4, 0, 3,\n",
      "        3, 3, 4, 0, 0, 3, 3, 2], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([1, 4, 2, 0, 4, 2, 3, 2, 2, 1, 3, 2, 1, 2, 1, 1, 3, 3, 4, 4, 3, 3, 1, 3,\n",
      "        2, 1, 0, 1, 4, 2, 2, 4, 2, 3, 3, 3, 4, 3, 4, 1, 1, 1, 0, 3, 1, 1, 2, 4,\n",
      "        1, 3, 3, 1, 3, 4, 0, 4, 1, 1, 0, 4, 4, 4, 3, 4, 1, 2, 2, 3, 4, 2, 0, 2,\n",
      "        3, 1, 2, 4, 0, 3, 2, 1, 2, 1, 3, 0, 4, 4, 4, 3, 2, 0, 2, 2, 4, 2, 1, 2,\n",
      "        4, 3, 3, 2, 1, 3, 2, 4, 1, 1, 2, 0, 4, 3, 3, 1, 2, 0, 2, 4, 1, 4, 0, 3,\n",
      "        3, 3, 4, 0, 0, 3, 2, 2], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 0, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.9770833333333333\n",
      "============================================\n",
      "第43个epoch的识别准确率为：97%\n",
      "epoch:44,loss:0.0690\n",
      "============================================\n",
      "源数据标签： tensor([4, 4, 3, 1, 3, 3, 2, 1, 1, 3, 0, 1, 4, 1, 2, 2, 1, 0, 4, 0, 0, 3, 3, 4,\n",
      "        1, 4, 4, 2, 1, 3, 2, 2, 0, 2, 1, 0, 3, 2, 0, 4, 2, 1, 3, 1, 1, 2, 1, 2,\n",
      "        4, 3, 0, 2, 4, 4, 2, 3, 3, 0, 3, 0, 1, 1, 1, 0, 2, 1, 1, 0, 3, 3, 2, 2,\n",
      "        1, 3, 0, 4, 3, 2, 1, 0, 4, 3, 0, 3, 0, 1, 2, 3, 3, 2, 1, 0, 1, 2, 2, 0,\n",
      "        4, 0, 1, 1, 1, 4, 1, 3, 3, 1, 3, 2, 0, 1, 1, 3, 2, 1, 2, 1, 4, 4, 2, 0,\n",
      "        4, 1, 2, 3, 2, 2, 0, 2], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([4, 4, 3, 1, 3, 3, 2, 1, 1, 3, 0, 1, 4, 1, 2, 2, 1, 0, 4, 0, 0, 3, 3, 4,\n",
      "        1, 4, 4, 2, 1, 3, 2, 2, 0, 2, 1, 0, 4, 2, 0, 4, 2, 1, 3, 1, 1, 2, 1, 2,\n",
      "        4, 3, 0, 2, 4, 4, 2, 3, 3, 0, 3, 0, 1, 1, 1, 0, 3, 1, 1, 0, 3, 3, 2, 2,\n",
      "        1, 3, 0, 4, 3, 2, 1, 0, 4, 3, 0, 3, 0, 1, 2, 3, 3, 2, 1, 0, 1, 2, 2, 0,\n",
      "        4, 0, 1, 1, 1, 4, 1, 3, 3, 1, 3, 2, 0, 1, 1, 3, 2, 1, 2, 1, 4, 4, 2, 0,\n",
      "        4, 1, 2, 3, 2, 2, 0, 2], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.9684895833333333\n",
      "============================================\n",
      "第44个epoch的识别准确率为：96%\n",
      "epoch:45,loss:0.0533\n",
      "============================================\n",
      "源数据标签： tensor([2, 3, 2, 1, 1, 3, 0, 3, 1, 1, 2, 3, 0, 3, 1, 4, 0, 4, 3, 0, 0, 1, 2, 1,\n",
      "        2, 2, 4, 3, 4, 3, 2, 1, 1, 4, 1, 4, 1, 1, 4, 4, 2, 3, 3, 1, 0, 3, 2, 0,\n",
      "        4, 4, 3, 3, 3, 0, 0, 2, 3, 2, 0, 1, 4, 2, 1, 1, 2, 1, 3, 1, 1, 2, 0, 1,\n",
      "        3, 2, 4, 2, 1, 1, 3, 1, 2, 2, 3, 2, 1, 2, 1, 1, 0, 2, 2, 1, 3, 2, 2, 4,\n",
      "        4, 3, 3, 0, 1, 1, 3, 2, 1, 2, 3, 3, 1, 1, 0, 4, 3, 3, 2, 2, 3, 3, 1, 2,\n",
      "        1, 2, 0, 0, 1, 2, 4, 0], device='cuda:0')\n",
      "============================================\n",
      "预测结果： tensor([2, 3, 2, 1, 1, 3, 0, 3, 1, 1, 2, 3, 0, 3, 1, 4, 0, 4, 3, 0, 0, 1, 2, 1,\n",
      "        2, 2, 4, 3, 4, 3, 2, 1, 1, 4, 1, 4, 1, 1, 4, 4, 2, 3, 3, 1, 0, 3, 2, 0,\n",
      "        4, 4, 3, 3, 3, 0, 0, 2, 3, 2, 0, 1, 4, 2, 1, 1, 2, 1, 3, 1, 1, 2, 0, 1,\n",
      "        3, 4, 4, 2, 1, 1, 3, 1, 2, 2, 3, 2, 1, 2, 1, 1, 0, 2, 2, 1, 3, 2, 2, 4,\n",
      "        4, 3, 3, 0, 1, 3, 3, 2, 1, 2, 3, 3, 1, 1, 0, 4, 3, 3, 2, 2, 3, 4, 1, 2,\n",
      "        1, 2, 0, 0, 1, 2, 4, 0], device='cuda:0')\n",
      "相等的结果为： tensor([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1], device='cuda:0', dtype=torch.uint8)\n",
      "0.9747395833333333\n",
      "============================================\n",
      "第45个epoch的识别准确率为：97%\n",
      "训练完毕，权重已保存为：weights/last.pkl\n"
     ]
    }
   ],
   "source": [
    "# ============================ step 5/5 训练 ============================\n",
    "# 记录每一次的数据，方便绘图\n",
    "train_curve=list()\n",
    "valid_curve=list()\n",
    "model.train()\n",
    "accurancy_global=0.0\n",
    "for epoch in range(MAX_EPOCH):\n",
    "    loss_mean=0.\n",
    "    correct=0.\n",
    "    total=0.\n",
    "    running_loss = 0.0\n",
    "\n",
    "    for i,data in enumerate(train_loader):\n",
    "        img,label=data\n",
    "        img = Variable(img)\n",
    "        label = Variable(label)\n",
    "        if torch.cuda.is_available():\n",
    "            img=img.cuda()\n",
    "            label=label.cuda()\n",
    "        \n",
    "#         print(img.size())\n",
    "        # 前向传播\n",
    "        out=model(img)\n",
    "        optimizer.zero_grad()  # 归0梯度\n",
    "        loss=criterion(out,label)#得到损失函数\n",
    "\n",
    "        print_loss=loss.data.item()\n",
    "\n",
    "        loss.backward()#反向传播\n",
    "        optimizer.step()#优化\n",
    "        if (i+1)%log_interval==0:\n",
    "            print('epoch:{},loss:{:.4f}'.format(epoch+1,loss.data.item()))\n",
    "        _, predicted = torch.max(out.data, 1)\n",
    "        total += label.size(0)\n",
    "        if (i+1)%log_interval==0:\n",
    "            print(\"============================================\")\n",
    "            print(\"源数据标签：\",label)\n",
    "            print(\"============================================\")\n",
    "            print(\"预测结果：\",predicted)\n",
    "            print(\"相等的结果为：\",predicted == label)\n",
    "        correct += (predicted == label).sum()\n",
    "        if (i+1)%log_interval==0:\n",
    "            print(correct.item() / total)\n",
    "#         print(correct.item())\n",
    "    print(\"============================================\")\n",
    "    accurancy=correct.item() / total\n",
    "    if accurancy>accurancy_global:\n",
    "        torch.save(model.state_dict(), './weights/best326.pkl')\n",
    "        print(\"准确率由：\", accurancy_global, \"上升至：\", accurancy, \"已更新并保存权值为weights/best.pkl\")\n",
    "        accurancy_global=accurancy\n",
    "    print('第%d个epoch的识别准确率为：%d%%' % (epoch + 1, 100*accurancy))\n",
    "# torch.save(model.state_dict(), './weights/last607.pkl')\n",
    "print(\"训练完毕，权重已保存为：weights/last.pkl\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "have done\n"
     ]
    }
   ],
   "source": [
    "print('have done')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
